Recordsets Collection
A Recordsets collection contains all open Recordset objects in a Connection or Database object.
Remarks
When you use DAO objects, you manipulate data almost entirely using Recordset objects.
A new Recordset object is automatically added to the Recordsets collection when you open the Recordset object, and is automatically removed when you close it.
You can create as many Recordset object variables as needed. Different Recordset objects can access the same tables, queries, and fields without conflicting.
To refer to a Recordset object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
Recordsets(0)
Recordsets("name")
Recordsets![name]
Note |
---|
You can open a Recordset object from the same data source or database more than once, creating duplicate names in the Recordsets collection. You should assign Recordset objects to object variables and refer to them by variable name. |
Example
This example demonstrates Recordset objects and the Recordsets collection by opening four different types of Recordsets, enumerating the Recordsets collection of the current Database, and enumerating the Properties collection of each Recordset.
Visual Basic for Applications |
---|
|