Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: "Undefined Function in Expression" Error Message


View products that this article applies to.

This article was previously published under Q208884
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).

↑ Back to the top


Symptoms

When you call a user-defined function from within an aggregate (totals) function, such as the Sum() function, in a report, you may receive the following error message:
Undefined function '<function name>' in expression.

↑ Back to the top


Cause

The user-defined function is located in the report module.

↑ Back to the top


Resolution

Transfer the user-defined function from the report module to a global module.

↑ Back to the top


Status

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

↑ Back to the top


More information

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce Problem

  1. Open the sample database Northwind.mdb.
  2. Open the Alphabetical List Of Products report in Design view.
  3. Add a text box with the following property to both the detail section and the Product Name footer section of the report:
    ControlSource: =Sum(Notwork())
  4. On the View menu, click Code.
  5. Type the following user-defined function in the report module:
    Function Notwork()
       Notwork=8
    End function
    					
  6. Close the report module.
  7. Preview the report.

    Note that you receive the error message mentioned in the "Symptoms" section.

↑ Back to the top


References

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

↑ Back to the top


Keywords: KB208884, kbnofix, kbbug, kberrmsg

↑ Back to the top

Article Info
Article ID : 208884
Revision : 2
Created on : 6/28/2004
Published on : 6/28/2004
Exists online : False
Views : 249