Count Checkboxes

  • Thread starter Thread starter Fletcher
  • Start date Start date
F

Fletcher

Hi, I'm wondering if there's a way to count checkboxes. What I have is
a subform that links to the main form through PassID, and the subform
has a LotNumber (text box) and a TwoCassetteLot (checkbox) entry. The
subform displays in continuous forms, and I limit the number of entries
to 6 through code. What I would like to do is count the number of
checkboxes and subtract that from 6 to reduce the number of entries
that can be put in on the subform. If anyone knows how I could do
this, I would be very greatful. If you need more info, I'll do my best
to give it to you. Thanks in advance,

Fletcher...
 
Sum the check boxes.

Access uses -1 for True, and 0 for False. So if you sum the check boxes, you
get the negative count of the number that are checked.

In the Form Footer section of your continuous form, add a text box with
Control Source:
=Abs(Sum([TwoCassetteLot]))
or perhaps you want to show the number remaining:
=6 - Abs(Sum([TwoCassetteLot]))

To prevent further entries, cancel the BeforeInsert event of the form.
 
Back
Top