I have a field that uses checkboxes in my table. What would be the best way to sum the amount that are checked and put the total in the form detail section or footer if need be?
Thanks.
I have a field that uses checkboxes in my table. What would be the best way to sum the amount that are checked and put the total in the form detail section or footer if need be?
Thanks.
You want to count how many records are Yes?
Sum(Abs([fieldname]))
Or you want to sum another field for only those records that are Yes?
Sum(IIf([field1]=True, [field2], 0))
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
checkboxes are Boolean values which are numeric - i.e. -1 for true or yes and 0 for no or false
so depends on where your source is but the basic formula would be
sum(abs(chkboxfield))
e.g.
dsum("abs(chkboxfield)","myTable")
or you could use
abs(dsum("chkboxfield","mytable")
or in a query, something like
SELECT sum(abs(chkboxfield)) FROM myTable
Thanks a lot. That worked.