ACC: Cannot Sum Calculated Controls in Forms or Reports (113354)
The information in this article applies to:
- Microsoft Access 1.0
- Microsoft Access 1.1
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q113354
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you open a form or report, "#Name?" is displayed in a text box in a
form footer, or a parameter box appears requesting the field specified in
the sum expression in a report.
CAUSE
The text box is trying to perform a sum on a calculated control in the
form or report and because Microsoft Access does not store calculated
values, it cannot sum the calculated field.
RESOLUTION
There are two workarounds to this behavior:
- Repeat the calculation being computed in the calculated control in the
sum expression. If the calculated control on the form or report has the
expression
=[UnitPrice] * [Quantity]
repeat this calculation in the sum expression as:
=SUM([UnitPrice] * [Quantity])
NOTE: In versions 1.x and 2.0, there is a space in Unit Price.
- Base the form or report on a query and calculate the expression as a
calculated field in the query, rather than as a calculated control on
the form or report. Because the calculation is being computed in the
query, the result will be available for other computations. This method
is considerably faster than the first method because the computation
does not have to be repeated. If the calculated control on the form or
report has the expression
=[UnitPrice] * [Quantity]
then the new calculated field in the query will have the following in
the Field row of the query grid:
ExtendedPrice: [UnitPrice] * [Quantity]
If the form or report is based on a query with this calculated field,
ExtendedPrice will appear in the field list and should be used in place
of the calculated control on the form or report. The sum expression in
the form or report footer would look like the following:
=SUM([ExtendedPrice])
REFERENCES
For more information about using calculated controls in forms and reports,
search the Help Index for "Calculated Controls," or ask the Microsoft
Access 97 Office Assistant.
Modification Type: | Major | Last Reviewed: | 5/6/2003 |
---|
Keywords: | kberrmsg kbprb KB113354 |
---|
|