Microsoft Office 2000/Visual Basic Programmer's Guide |
In general, for all VBA code, you should qualify object names by preceding them with the object library's ProgID to correctly resolve references to identically named objects in two or more referenced object libraries. If you include references to both ADO and DAO object libraries in your VBA project, it is absolutely necessary to qualify object names. This is because DAO and ADO include several objects with the same names. For example, both models include a Recordset object, so if you are using both DAO and ADO references, the following code is ambiguous:
Dim rstCustomers As Recordset object
To specify which object library you want to use, include the object library's ProgID in front of the object name:
Dim rstADO As ADODB.Recordset
Dim rstDAO As DAO.Recordset
If the ProgID qualifier is omitted, VBA will use the object from the first object library in the References dialog box list, and your code may not function properly.