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.
jcaiolaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RyanConnect With a Mentor Project Engineer, ElectricalCommented:
A Query
Select Sum(PassesIssued) as SumOfPassesIssued FROM tblTableName

A Function in textbox
Set the control Source to
=DSum("PassesIssued","TblTableName","WHERE TRUE")
0
 
grendel777Commented:
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

0
 
grendel777Commented:
Sorry MrBullwinkle, we were typing at the same time!
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
jcaiolaAuthor Commented:
What does the Where True statement do?
0
 
grendel777Commented:
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!
0
 
jcaiolaAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.