Show a count of a field in a text box on a form - JCW

  • Thread starter Thread starter JohnW
  • Start date Start date
J

JohnW

I would like to show the count of total current records in a specific field
and have the count show in a text box on my main form that opens when the
program is launched so I can see count without having to run a query, etc.

My main table is ECG and the field that I want to count is lupactive which
will have yes in the field to indicate that the record is current.

Any ideas would be appreciated. Thanks
 
In Form design view, display the Form Header/Footer.

Add a text box to the Form Footer section, and set its Control Source like
this:
= - Sum([lupactive])

This assumes that the form gets its records from the ECG table. If it's
another table, use:
= - DSum("lupactive", "ECG")

The expressions rely on the fact that Access uses -1 for True, and 0 for
False. The sum of the field therefore yields the negative count of the
Trues.
 
Back
Top