ACC: How to Reference Classes That Exist in Multiple LibrariesLast reviewed: August 29, 1997Article ID: Q163657 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. 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 you want to use. This article addresses how to specify a particular reference file in code. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.
MORE INFORMATIONSuppose 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.5 Object Library (or Microsoft DAO 3.0 Object Library in version 7.0), which also contains a class called RecordSet. In order to dimension a variable of type RecordSet from the MyDatabase reference, you must use the following syntax:
Dim rs as MyDatabase.RecordSetIf you do not explicitly declare the reference name when you dimension the variable, then 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 (or in the Libraries/Databases box in version 7.0) of the Object Browser is the name of that reference. In Microsoft Access 7.0, if there is a dash (-) in the name of a reference, use the characters to the left of the dash as the reference name. For example, if you see "DAO - Microsoft DAO 3.0 Object Library" in the Libraries/Databases box, use DAO as the name of the reference.
REFERENCESFor more information about setting references in a Microsoft Access database, search the Help Index for "setting references." For more information about using the Object Browser, search the Help Index for "Object Browser." Keywords : kbcode PgmCM PgmHowTo Version : 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |