ACC: Valid Sum() Function Returns #Name? in Calculated Control

Last reviewed: May 7, 1997
Article ID: Q95442
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

If you open a form in Form view and have two or more calculated controls, you may receive a "#Name?" error in each of the calculated controls on the form even if the expression for that control is valid.

CAUSE

All of the domain functions are based on the same query (over the underlying dynaset). If one of the bound functions on the form has a binding error, all of the functions on the form return an error.

RESOLUTION

Find the control or controls that use an invalid expression. Either remove the controls or correct the expression you use for the controls.

MORE INFORMATION

You can use aggregate (totals) functions to calculate results only for fields, not for controls. Examples of aggregate functions are Sum(), Avg(), and Count().

Steps to Reproduce Behavior

  1. Create a new form based on the Orders table from the sample database Northwind.mdb (or NWIND.MDB in 1.x and 2.0).

  2. Add a text box to the form bound to the Freight field of this table. Set the following properties:

          Text Box
          ----------------------
          ControlName: Freight
          ControlSource: Freight
    

  3. Add an unbound text box to the form. Set the following properties:

          Text Box
          -----------------------------
          ControlName: Test1
          ControlSource: =Sum([Freight])
    

  4. Add another text box to the form. Set the following properties:

          Text Box
          ----------------------------
          ControlName: Test2.
          ControlSource: =Sum([Test1])
    

  5. View the form in Form view. Note that #Name? appears in the second and third text boxes (Test1 and Test2). Because you cannot use the Sum() function on a calculated expression, Test2 is invalid. This causes all calculated expressions on the form to return "#Name?."

If you remove Test2 from the form, Test1 will display the correct value.


Additional query words: poundname
Keywords : FmsHowto kberrmsg kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.