checkbox counting?

  • Thread starter Thread starter jonudden
  • Start date Start date
Sum the field, e.g.:
= - Sum([MyYesNoField])

Internally, Access uses -1 for True, and 0 for False, so when you sum a
yes/no field, you get the number of Yes answers as a negative value.
 
On Wed, 24 Aug 2005 03:46:31 -0500,
How do you count checkboxes that are checked in a report?

You don't... you count Yes/No fields that are stored in a Table. A
report is a way of displaying table data on paper, not a data storage
medium!

A Yes/No field is stored with Yes = -1, No = 0; so you can put a
textbox on a Report (or Section) footer with a control source

= -Sum([yesnofield])

If there are three records with yesnofield checked, the value will sum
to -3; the minus sign before Sum flips this to 3.

If you're counting across fields in a table, use the Query upon which
the report is based; add a calculated field

CountOfYes: - ([FieldA] + [FieldB] + [FieldC] + ... )

to similarly add up all the -1's and then make that sum positive.


John W. Vinson[MVP]
 

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

Back
Top