How do I count tick boxes in Access?

G

Guest

I have a number of tick boxes which are filled and a number that are empty.
I wish to count the checked ones and need help with the how.
 
J

John Spencer

Are all the Tick Boxes in one row or do you want to count the number in a
field in a set of records?

Tick boxes are yes/no fields and have the value of -1 or 0. So to "count"
the ones that are checked you can do the following:

Field: CountInRow: Abs(CheckBox1 + CheckBox2 + CheckBox3 + CheckBox4)

If you want to count them in one field across many records (rows) then you
can use a summary query and sum them

Field: Abs(Checkbox1) as CountChecks1
Total: Sum
 
G

Graham R Seach

Nat,

I assume by "tickboxes", what you actually mean is that you want to count
the Boolean True values in a table. In that case, just sum the absolute
values:
SELECT Sum(Abs(mybooleancolumn)) As Howmanybooleans
FROM mytable

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top