ACC2000: How to Reference Classes That Exist in Multiple Libraries
Symptoms
If your Microsoft Access database contains a reference to multiple librarydatabases, type libraries, or object libraries, it is possible for the sameclass name to exist in more than one referenced file. If you want todeclare a variable of that type, you must explicitly state which referencecontains the class that you want to use. This article shows you how tospecify a particular reference file in code.
Resolution
Suppose that your Microsoft Access database contains two references: onereference to a library database called MyDatabase, which contains a classcalled RecordSet, and another reference to Microsoft DAO 3.6 ObjectLibrary, 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 thevariable, whichever reference appears first in the References dialogbox is automatically assumed. If the wrong reference is assumed, you mayencounter error messages when you try to use the properties and methods ofthe declared object.
You can use the Microsoft Access Object Browser to determine the referencename. To use the Object Browser, open any module in Design view, and thenclick 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.
