Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you qualify a count total? 1

Status
Not open for further replies.

EarlJohnson

Vendor
May 20, 2002
7
0
0
US
I have several Yes/No check box fields in a table, and have produced a report that includes these fields. I want to be able to show the "Yes" totals of these fields at the end of my report, but I can't figure out the correct way to do it.

I've used =Sum([Field title]) which, for some reason works, but it produces a negative number as the total. For example, if I have 45 "Yes" checked boxes, then the total appears as -45.

I've also tried =Count([Field title])=Yes but that counts all of the records in the table, including the "No's". For example, if I have 100 records in the table but only 45 are "Yes" checked boxes, then the total appears as 100. I only want to count the records that have the Yes check boxes checked.

I feel like I am close to finding the way, and that the =Count([Field title])=Yes is part of the correct answer. What am I missing?

Thanks.
Earl
 
Earl,

Try using the absolute value:
Code:
=Abs(Sum([Field title]))
Yes/No fields store as a -1 when True and 0 when False, so summing them and taking the absolute value will return the count of checked boxes....
 
I am having this same prob. but I am using words like Pass Fail and I would like a count on pass. I was writting it the same way
 
If you are still looking for an answer try an expression like:
=Abs(Sum([GradeGiven]="Pass"))

dh
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top