Microsoft KB Archive/283806

= Visual Basic for Applications (VBA) functions break in a database with missing references =

Article ID: 283806

Article Last Modified on 11/27/2007

-

APPLIES TO


 * Microsoft Office Access 2003
 * Microsoft Access 2002 Standard Edition
 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition
 * Microsoft Office Word 2003
 * Microsoft Word 2002 Standard Edition

-



This article was previously published under Q283806



Moderate: Requires basic macro, coding, and interoperability skills.

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

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



For a Microsoft Access 97 version of this article, see 160870.



SYMPTOMS
If you have a procedure that contains a Visual Basic for Applications function and your database contains a reference to a missing object library or type library, you may receive one of the following error messages when you compile your modules or run the procedure:

Error message 1
Your Microsoft Access database or project contains a missing or broken reference to the file.


 * To ensure that your database or project works properly, you must fix this reference.


 * To learn how to fix this reference, click Help.

Error message 2
Compile Error:

Can't find project or library



CAUSE
Your database contains a reference to a database, type library, or object library that is marked as MISSING:  in the References dialog box.



RESOLUTION
To remove the missing reference, follow these steps:
 * 1) Open your database.
 * 2) Press ALT+F11 to open the Visual Basic Editor.
 * 3) On the Tools menu, click References.
 * 4) Click to clear the check box for the type library or object library marked as MISSING: .

An alternative to removing the reference is to restore the referenced file to the path that is specified in the References dialog box. If the referenced file is in a new location, clear the MISSING:  reference, and then create a new reference to the file in the new folder.

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

209849 How to loop through references to view their properties



Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb. Create a new form that is not based on any table or query. On the Insert menu, click ActiveX Control. In the Select an Activex control list, click Kodak Image Edit Control, and then click OK. Save the form as frmReference, and then close it.</li> Close Northwind.mdb, and then quit Access.</li> Find and rename the ImgEdit.ocx file to ImgEdit.old.</li> Start Access, and then open Northwind.mdb.</li> Open the Startup module in Design view.</li> On the Debug menu, click Compile Northwind. Note that you receive both of the error messages that are mentioned in the &quot;Symptoms&quot; section of this article.</li>  Click OK. Note that the References dialog box appears; the following reference is highlighted in the Available References dialog box: MISSING: Kodak Image Edit Control </li> Click Cancel in the Available References dialog box.</li> Find and rename the ImgEdit.old file to ImgEdit.ocx.</li> Repeat step 10 and note that the error message no longer appears.</li></ol>

<div class="references_section">