ACC2000: How to Reference Classes That Exist in Multiple Libraries

Article translations Article translations
Article ID: 209912 - View products that this article applies to.
This article was previously published under Q209912
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Expand all | Collapse all


If your Microsoft Access database contains a reference to multiple library databases, type libraries, or object libraries, it is possible for the same class name to exist in more than one referenced file. If you want to declare a variable of that type, you must explicitly state which reference contains the class that you want to use. This article shows you how to specify a particular reference file in code.


Suppose that your Microsoft Access database contains two references: one reference to a library database called MyDatabase, which contains a class called RecordSet, and another reference to Microsoft DAO 3.6 Object Library, which also contains a class called RecordSet. To dimension a variable of type RecordSet from the MyDatabase reference, you must use the following syntax:
Dim rs as MyDatabase.RecordSet
If you do not explicitly declare the reference name when you dimension the variable, whichever reference appears first in the References dialog box is automatically assumed. If the wrong reference is assumed, you may encounter error messages when you try to use the properties and methods of the declared object.

You can use the Microsoft Access Object Browser to determine the reference name. To use the Object Browser, open any module in Design view, and then click Object Browser on the View menu (or press the F2 key). The name that appears in the Project/Library box of the Object Browser is the name of that reference.


For more information about setting references, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type references command (tools menu) in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about using the Object Browser, click Microsoft Access Help on the Help menu, type work with objects in visual basic by using the object browser in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.


Article ID: 209912 - Last Review: October 11, 2006 - Revision: 1.5
  • Microsoft Access 2000 Standard Edition
kbcode kbhowto kbinfo KB209912

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from