Microsoft KB Archive/248941

= ACC2000: How Access 2000 Resolves Visual Basic for Applications References =

PSS ID Number: 248941

Article Last Modified on 5/16/2002

-

The information in this article applies to:


 * Microsoft Access 2000
 * Microsoft Visual Basic for Applications

-



This article was previously published under Q248941



For a Microsoft Access 2002 version of this article, see 286300.

Advanced: Requires expert coding, interoperability, and multiuser skills.

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



SUMMARY
This article explains the steps that Microsoft Access takes to resolve Visual Basic for Applications references.



MORE INFORMATION
To view the current references, start the Visual Basic Editor (press ALT+F11), and click References on the Tools menu.

The pertinent file, for example, a type library, object library, or control library, for each reference is loaded according to the information displayed in the References box. However, if the file is not found, Access takes the following steps to determine the file's location.

For each reference that is selected, Access does the following:  Access checks to see if the referenced file name is currently loaded.  If not, Access verifies whether the RefLibPaths registry key exists. If so, Access looks for a named value with the same name as the reference. If there is a match, Access loads the reference from the path pointed to by the named value.

You can add this key to the registry and then add the names and locations of any add-ins or libraries as string values beneath that key. Create the \RefLibPaths key in the following key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Access

Within the key, add a string value that specifies the name and location of the file to which the reference is set. The name should be the file name, including the extension, and the location should be the path plus the file name. For example, if you have set a reference to the Northwind sample database, you can add the following values: Name: Northwind.mdb Data: C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb NOTE: You do not need this key if the file that you want to reference is located in any of the directories that are mentioned in the table below.  If the RefLibPaths registry key does not exist or does not contain a proper reference, Access next uses the SearchPath API to search for the referenced file. The following searches are performed:



If the reference is not found, you may receive the following error message when you compile the project or try to run a procedure:

Compile Error:

Can't find project or library

NOTE: In an Access run-time application, you cannot view references from a menu. However, the following article demonstrates how to view references by using code:

209849 ACC2000: How to Loop Through References to View Their Properties

