D.4. OpenRecordset Constants

You'll use a variety of constants when writing VBA code. The following tables list just a few of the constants you might use when opening a DAO recordset.

NOTE

A runtime error occurs if you attempt to use dbOpenTable in the following Microsoft Access workspace situations:

When the recordset is based on a QueryDef

When the Source argument refers to an SQL statement or TableDef that refers to a linked table

The following table lists the constants that can be specified for the Type argument.

ConstantDescription
dbOpenTableReturns an editable dataset consisting of records from a single local table only. Cannot be used with linked tables (Microsoft Access workspaces only).
dbOpenDynasetReturns an editable dataset consisting of pointers to records in a table or query. Can be used on multiple local and linked tables (Microsoft Access workspaces only).
dbOpenSnapshotReturns a read-only dataset consisting of a copy of records in a table or query. Can be used on multiple local and linked tables (Microsoft Access workspaces only).
dbOpenForwardOnlyReturns an editable dataset consisting of records in a table. Use this option when you only need to move through the dataset in one pass and in one direction—forward (Microsoft Access workspaces only).

The following table lists the constants that can be specified for the Options argument.

The dbInconsistent and dbConsistent constants are mutually exclusive. Similarly you cannot supply a LockEdits argument on a recordset ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.