Microsoft KB Archive/123344

= ACC: "Undefined Function in Expression" Error Message =

Article ID: 123344

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q123344



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



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 ' ' in expression.



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



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



STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions 2.0, 7.0, and 97.



Steps to Reproduce Problem
 Open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 2.0). Open the Alphabetical List Of Products report in Design view.  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)  On the View menu, click Code.</li>  Enter the following user-defined function in the report module:

Function Notwork Notwork=8 End function </li> Close the report module.</li> Preview the report. Note that you receive the error message described earlier in this article.</li></ol>

<div class="references_section">