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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Check boxes in access

Status
Not open for further replies.

JoelK

Technical User
Mar 13, 2001
2
GB
I have created an access d'base with approx 40 check boxes for each record.

I want create a query that will add the total number of
boxes checked for each of the 40 options. I have already set up a commencement and end date.
 
try something like this

SELECT ABS(SUM(YesNo1+YesNo2+YesNo3+...+YesNo40))
FROM tblOne;


Just list all the fields as additions in the SUM function

Dave
 
That's why I NEVER use the checkboxes. They have a value of -1 for YES and 0 for NO. Or is it vice-versa. See! I can never remember, so I just use Y or N instead of a checkbox so I don't have to remember.

Anyway, if you insist, then you do an IIF = to negative 1 or zero.
techsupportgirl@home.com
Brainbench MVP for Microsoft Word
 
That's why I NEVER use the checkboxes. They have a value of -1 for YES and 0 for NO. Or is it vice-versa. See! I can never remember, so I just use Y or N instead of a checkbox so I don't have to remember.

Anyway, if you insist, then you do the criteria where it's equal to -1 or 0
techsupportgirl@home.com
Brainbench MVP for Microsoft Word
 
This should work for you:

SELECT Count(tTable1.YesNoField) AS [Count of Yes]
FROM tTable1
WHERE (((tTable1.YesNoField)=Yes));

- tTable1 is your table with the rows to count
- YesNoField is the checkbox field
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top