Microsoft KB Archive/248941

From BetaArchive Wiki
Knowledge Base

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


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


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:

  1. Access checks to see if the referenced file name is currently loaded.
  2. 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:


    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.

  3. 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:

    Search area Description
    Application Directory Location of Msaccess.exe.
    Current directory Directory that you see if you click Open on the File menu.
    WinDir Folder where the operating system files are running. This is usually the Windows or Winnt folder.
    System Directory The System and System32 folders, located in the WinDir.
    PATH environment variable This system variable contains a list of folders directly accessible by the system.

    In Microsoft Windows 95 and 98: The PATH statement located in the Autoexec.bat file.

    In Microsoft Windows NT: In Control Panel, open the System tool, and click the Environment tab. The path is in the System Variables list.

    In Microsoft Windows 2000: In Control Panel, open the System tool, and on the Advanced tab, click Environment Variables. The path is in the System Variables list.

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


For more information about references, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type references command in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For additional information about missing references, click the article number below to view the article in the Microsoft Knowledge Base:

208218 ACC2000: VBA Functions Break in Database with Missing References

Additional query words: pra type libraries compile error can t find project or library

Keywords: kbinfo KB248941
Technology: kbAccess2000 kbAccess2000Search kbAccessSearch kbVBASearch kbZNotKeyword3 kbZNotKeyword6