When you use ADO, you do not have to create recordsets from external data sources. Instead, your application can build dynamic recordsets to manage data internal to your application.
To create a dynamic recordset, declare and instantiate a normal Recordset object variable. However, since there is no data source, you will not specify connection information or use the Open method.
To see a demonstration of how to create and use a dynamic recordset, click this icon.
Use the Fields collection and the Append method to create new fields on the recordset. When you create a field, you must specify a name and a data type for the field. In addition, if you specify a string data type, you must also pass the length of the string. For more information about the ADO data type constants that are supported, read the article "Type Property (ADO)" in ADO Help.
The following example code creates a dynamic recordset and adds two fields:
Dim rsFileInfo As Recordset
Set rsFileInfo = New Recordset
rsFileInfo.Fields.Append "ID", adInteger
rsFileInfo.Fields.Append "FileName", adBSTR, 255
Once fields have been added to the recordset, you can add records, delete records, and change values of the recordset. Dynamic recordsets also support saving and opening persisted data. To see sample code that reads file names from a hard drive and saves the information in a recordset, click this icon.