Using Recordset Objects

You use Recordset objects to manipulate the data in a database at the record level. There are five types of Recordset objects — table, dynaset, snapshot, forward-only, and dynamic. Table-type Recordset objects are available only in Microsoft Jet workspaces. Dynamic-type Recordset objects are available only in ODBCDirect workspaces. You specify the type of recordset you want to open by using the type argument of the OpenRecordset method.

The type of Recordset object you use depends on what you want to do and whether you want to change or simply view the data. For example, if you must sort the data or work with indexes, use a table-type Recordset object. Because they are indexed, table-type Recordset objects also provide the fastest way to locate data. For example, you can use the Seek method to quickly locate records in an indexed table-type Recordset object only. To search for records in other Recordset object types, you must use the FindFirst, FindLast, FindNext, or FindPrevious method. If you want to be able to update a set of records selected by a query, use a dynaset. If the table-type is unavailable in a specific situation and you only need to scan through a set of records, using a snapshot-type or a forward-only-type Recordset object may improve performance.

Using a table-type Recordset object, if that type is available, almost always results in the best performance.

Note In this chapter, the terms table, dynaset, snapshot, forward-only, and dynamic are often used for the sake of simplicity. Keep in mind, however, that these are all types of Recordset objects. For example, the term dynaset refers to a dynaset-type Recordset object.