Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Reference Classes That Exist in Multiple Libraries


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


References

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.

↑ Back to the top


Keywords: KB209912, kbinfo, kbhowto, kbcode

↑ Back to the top

Article Info
Article ID : 209912
Revision : 6
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 385