sum of values in checkboxes

I have 8 checkboxes fields in a table chk1, chk2, etc.

I would like, in a query, sum up all the 8 checkboxes for each row counting one for the checked ones and zero for the unchecked.

Any idea?

I tried chk1+chk2 but I always get zero...
fitalianoAsked:
Who is Participating?
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Since in Access True = -1 and False = 0, if you do a [chk1]+[chk2] etc. it should return the negative value of how many were checked.   Then just do an abs([chk1]+[chk2]) to convert it to a positive number.  

Also, if your check box is a triple state, meaning it can contain NULL values, [chk1] is going to have to change to Nz([chk1],0) to convert the NULL values to zero, so you can do the math.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.