VBA Access Recordset, Object Library
If you are going to be working with the Recordset object in VBA for Access, there are 2 options.
- Early binding
- Late binding
In the first method we add reference to the Access Object Library, before execution. It will run faster and we will have access to the VBA editor intellisense. On the other hand there is always the risk of compatibility issues arising when the program is run on a computer with a different version of the library installed. For more information about early vs late binding please see the link below:
In this method you must add reference to the Microsoft ActiveX Data Object Library.
Locate the Microsoft ActiveX Data Object Library and select it:
Note: The version installed on my computer might be different than the version installed on the computer you are using. This shouldn’t cause a problem.
The object can be initiated using the code below:
Method 2, Late Binding:
In this method we don’t need to add a reference to the object library. The Recordset object is declared as a general object and intiated as shown below: