"Undefined Function <FunctionName> in Expression" error message when you try to open a query that contains a function (824277)



The information in this article applies to:

  • Microsoft Office Access 2003

Moderate: Requires basic macro, coding, and interoperability skills. This article applies only to a Microsoft Access database (.mdb).

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

SYMPTOMS

When you try to open a query that contains a function, you receive the following error message:

Your Microsoft Access database or project contains a missing or broken reference to the file <FileName>.

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

To learn how to fix this reference, click Help.
When you click OK on the previous error message, you receive the following error message:

Undefined function <FunctionName> in expression.

CAUSE

Your database contains a reference to the database, the type library, or the object library that is marked as missing in the MISSING: <referencename> check box that is in the References dialog box.

WORKAROUND

To remove the reference that is marked missing, follow these steps:
  1. Start Access.
  2. Open your database.
  3. Press ALT+F11 to open the Visual Basic Editor.
  4. On the Tools menu, click References.
  5. Click to clear the MISSING: <referencename> check box for the type library or for the object library.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

When you open a database in Access 2003, you are informed about any problems with referencing external libraries and projects. When the database has a broken reference to a library or to a project at the time you try to run a query that calls a function, Access 2003 displays the first error message that is in the "Symptoms" section. When you click OK on that message, you receive the second error message that is in the "Symptoms" section.

The first error message that is in the "Symptoms" section appears one time. Even when you have other queries that have calls to functions, the other queries only return the second error message that is in the "Symptoms" section until you close the database, and then reopen the database.

Caution If you follow the steps in this sample, you modify the Northwind.mdb sample database. You must back up Northwind.mdb, and then follow these steps on a copy of the database.

Steps to Reproduce the Problem

  1. Start Access 2003, and then click Blank Database.
  2. Click Create to create a new database.

    The new database is named Db1.mdb. Notice where the new database is located.
  3. Close Db1.mdb, and then open Northwind.mdb.
  4. Use the following Microsoft SQL statements to create two new queries.
    • SELECT CustomerID, CompanyName, ContactName, ContactTitle, Trim([City]) 
      	& ", " & Trim([Region]) & " " & Trim([PostalCode]) AS CoAddress FROM 
      	Customers;
      Save the previous query as QryTest.
    • SELECT CustomerID, Left([CompanyName],4) AS ShortName FROM Customers;
      
      Save the previous query as QryTest2.
  5. On the View menu, point to Database Objects, and then click Modules.
  6. Open the Utility Functions module in Design view. On the Tools menu, click References.
  7. In the References - Northwind dialog box, click Browse.
  8. Select Microsoft Access Databases (*.mdb) in the Files of type list, and then move to the folder where you put Db1.mdb.
  9. Click Db1.mdb, and then click Open.
  10. Click OK in the References dialog box, and then quit Access.
  11. Open Windows Explorer, and then move to the folder where you put Db1.mdb. Delete Db1.mdb.
  12. Reopen Northwind.mdb, and then try to open the QryTest query in Datasheet view.

    Notice that you receive the first error message that is in the "Symptoms" section.
  13. Click OK in the Error Message box.

    Notice that next you receive the second error message that is in the "Symptoms" section.
  14. Click OK in the second Error Message box. Try to open the QryTest2 query.

    Notice that you receive only the second error message that is in the "Symptoms" section.

REFERENCES

For more information about how to add references, click Microsoft Office Access 2003 Help on the Help menu, type references in the Search for box in the Assistance pane, and then click Start searching to view the topic.

Modification Type:MinorLast Reviewed:6/8/2004
Keywords:kberrmsg kbbug KB824277 kbAudDeveloper