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: Valid Sum() Function Returns #Error? in Calculated CTRL


View products that this article applies to.

Symptoms

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

↑ Back to the top


Cause

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

↑ Back to the top


Resolution

Find the control or controls that use an invalid expression. Then, either remove the control or correct the expression that you use for the control.

↑ Back to the top


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.
  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 #Error? 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 "#Error?."
If you remove Test2 from the form, Test1 will display the correct value.

↑ Back to the top


Keywords: KB199355, kbusage, kbprb, kberrmsg

↑ Back to the top

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