Dynamic-Type Recordset Objects

An additional type of Recordset object, the dynamic-type Recordset object, is available in ODBCDirect workspaces. Dynamic-type Recordset objects behave like dynaset-type Recordset objects, but they are updated dynamically as other users make modifications to the underlying tables. To create a dynamic-type Recordset object, specify the dbOpenDynamic constant for the type argument of the OpenRecordset method.

Dynamic-type Recordset objects are available only if you’re using an ODBC driver that supplies its own cursors. Because not all ODBC drivers supply their own cursors, you need to determine whether yours does before you try to open a dynamic-type Recordset object. If your ODBC driver doesn’t supply its own cursors, then you should open a snapshot-type or forward-only-type Recordset object instead.

See Also For more information on cursors, see “Using Cursors in ODBCDirect Workspaces” later in this chapter.

The advantage of using a dynamic-type Recordset object is that the recordset will immediately reflect any changes to the data, including added or deleted records. For example, if you open a dynamic-type Recordset object and another user edits a record in one of the underlying tables, that change will be reflected in the Recordset object you opened. In order to do this, however, DAO must constantly requery the data source, which may slow performance considerably. Therefore, avoid using dynamic-type Recordset objects except in situations where it’s crucial to have the most up-to-date data at all times.