Microsoft KB Archive/280465

= ACC97: How Access 97 Resolves Visual Basic for Applications References =

PSS ID Number: 280465

Article Last Modified on 10/20/2003

-

The information in this article applies to:


 * Microsoft Access 97
 * Microsoft Visual Basic for Applications

-



This article was previously published under Q280465



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

For a Microsoft Access 2000 version of this article, see 248941.



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



MORE INFORMATION
To view the current references, open a new or an existing code module or code in a form or report, and then 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 location of the file.

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 that is 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 value beneath that key. Create the \RefLibPaths key in the following key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\8.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 folders mentioned in the following table.  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:

186305 ACC97: How to Loop Through References to View Their Properties

