Link to home
Start Free TrialLog in
Avatar of jcaiola
jcaiola

asked on

Total of a Table's Field in Access Form

This one is probably a no-brainer, but I must not be thinking clearly. I have a field in a table and I want to place the total of the values in the field onto a form. Example - fields in table contain PassesIssued to a certain event. I want to aggregate those fields (that meet a certain set of conditions) and place that total on the form. So, my form could say the total number of passes issued.
ASKER CERTIFIED SOLUTION
Avatar of Ryan
Ryan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi jcaiola, the easiest (though not fastest) way to do it is to set a textbox's controlsource to a DSUM function.  DSUMs can be slow so I advise against using too many of them on any form or report.
=DSUM("PassesIssued","tblPasses")

Open in new window

Sorry MrBullwinkle, we were typing at the same time!
Avatar of jcaiola
jcaiola

ASKER

What does the Where True statement do?
The last component is an optional criteria, basically a WHERE clause if you want to limit the rows summed.  For example, if you wanted to sum the passes for a particular customer, you could put:

=DSUM("PassesIssued","tblPasses", "CustID = 123456")

"Where TRUE" just explicitly says "show me everything," which is the functional equivalent of leaving it blank.  MrBullwinkle was letting you know it's there if you need it.  Give him the points (if this works for you) - he was there first.

Good luck!
Avatar of jcaiola

ASKER

Thanks