ACC95: Domain Aggregate Functions Return #Error When Interrupted
Article ID: 148302
Article Last Modified on 11/17/2000
APPLIES TO
- Microsoft Access 95 Standard Edition
This article was previously published under Q148302
SYMPTOMS
Moderate: Requires basic macro, coding, and interoperability skills.
When you use Microsoft Access domain aggregate (totals) functions on a
form, the functions may return the "#Error" message. Domain aggregate
functions, such as DSum() and DCount(), evaluate an entire column or set
of data (a domain).
CAUSE
This error occurs when focus is moved from the form's active control to any
other control before the domain aggregate function has finished
calculating. This behavior occurs with all domain aggregate functions.
RESOLUTION
Use one of the two following methods to work around this problem.
Method 1
- Open the form containing the domain aggregate function in Design view
and set the form's OnCurrent property to the following event procedure
Sub Form_Current()
Me!<text box control name> = <expression>
End Sub
where <text box control name> refers to the name of the text box control
on the form where you want to display the result of the expression and
<expression> refers to the domain aggregate function expression used to
complete your calculation.
- Select the text box control containing the domain aggregate function.
- Delete the formula currently in the ControlSource property.
Method 2
- Create the following new macro
Macro Name Macro Action
-----------------------------
DFunctionMacro SetValue
DFunctionMacro Actions
-------------------------------
SetValue
Item: <text box control name>
Expression: <expression>
where <text box control name> refers to the name of the text box
control on the form where you want to display the result of the
expression and <expression> refers to the domain aggregate function
expression used to complete your calculation.
- Select the text box control containing the domain aggregate function.
- Delete the formula currently in the ControlSource property.
- Set the form's OnCurrent property to the DFunctionMacro macro.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 7.0.
This problem no longer occurs in Microsoft Access 97.
REFERENCES
For more information about domain aggregate functions, search the Help
Index for "domain aggregate functions."
Additional query words: dlookup davg dmax dmin dvar dstdev
Keywords: kberrmsg kbbug kbfix kbusage KB148302