OpenRecordset Method

Creates a new Recordset object that describes the results of an SQL query.

Applies to objects: Connection, Database, TableDef.

Syntax

[[Set] RetVal = ] object.OpenRecordset([Name], [CursorType])

The OpenRecordset method syntax has these parts:

Part Description
object Required. A reference to an instance of the object.
RetVal Optional. A Recordset type variable.
Name Optional. A String type variable. The name of the opened table, stored procedure, or an SQL query.
CursorType Optional. A Long type variable. The pointer type. The default value is cdbCursorForwardOnly.

Remarks

The Name parameter may contain the name of the opened table, the stored procedure or an SQL query. If the method is applied to the TableDef object, the Name parameter is omitted and the method opens the table.

The CursorType variable defines the pointer type. Can have the following values:
cdbCursorForwardOnly - the pointer can move only forward and is not sensitive to changes in the database.
cdbCursorStatic - the pointer is not sensitive to changes in the database.
cdbCursorKeySet - the pointer is sensitive to updates in the database.
cdbCursorDynamic - the pointer is sensitive to all changes in the database. .

For defining the supported pointer types, the Cursors mask is used.

Example

.......

 

See Also

Connection Object, Database Object, Recordset Object, TableDef Object, Cursors Property.