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

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
 
A

Allen Browne

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.
 

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