DAO Object
 
Creates a new Recordset object and appends it to the Recordsets collection.
 

Syntax

expression .OpenRecordset(TypeOptionsLockEdit)
expression A variable that represents a QueryDef object.
 

Parameters

Name
Required/optional
Data type
Description
Type
Optional
Variant
RecordsetTypeEnum constant that indicates the type of Recordset to open.
NOTE: If you open a Recordset in a Microsoft Access workspace and you don't specify a type, OpenRecordset creates a table-type Recordset, if possible. If you specify a linked table or query, OpenRecordset creates a dynaset-type Recordset.
Options
Optional
Variant
A combination of RecordsetOptionEnum constants that specify characteristics of the new Recordset.
NOTE: The constants dbConsistent and dbInconsistent are mutually exclusive, and using both causes an error. Supplying a lockedits argument when options uses the dbReadOnly constant also causes an error.
LockEdit
Optional
Variant
LockTypeEnum constant that determines the locking for the Recordset.
NOTE: You can use dbReadOnly in either the options argument or the lockedits argument, but not both. If you use it for both arguments, a run-time error occurs.
 

Return value

Recordset
 

Remarks

You should also use the dbSeeChanges constant if you open a Recordset in a Microsoft Access database engine-connected ODBC workspace against a Microsoft SQL Server 6.0 (or later) table that has an IDENTITY column, otherwise an error may result.
Opening more than one Recordset on an ODBC data source may fail because the connection is busy with a prior OpenRecordset call. One way around this is to fully populate the Recordset by using the MoveLast method as soon as the Recordset is opened.
Closing a Recordset with the Close method automatically deletes it from the Recordsets collection.
 
 Note
If source refers to an SQL statement composed of a string concatenated with a non-integer value, and the system parameters specify a non-U.S. decimal character such as a comma (for example, strSQL = "PRICE > " & lngPrice, and lngPrice = 125,50), an error occurs when you try to open the Recordset. This is because during concatenation, the number will be converted to a string using your system's default decimal character, and SQL only accepts U.S. decimal characters.