Microsoft KB Archive/209912

= ACC2000: How to Reference Classes That Exist in Multiple Libraries =

Article ID: 209912

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



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).



SUMMARY
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.



MORE INFORMATION
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.

