how to dispaly count of records in a form??

S

Swaminathan

Hello,
Thanks first for any suggestions!
How can I include the count of a particular field from a
query in a form??
I have a field with many country names in a query. There
is a repetition of the same country several times.
In my form, I have a combo box with the list of countries.
I want to diplay the number of times the country has
appeared in the field.

Thanks,
With regards,
Swaminathan
 
J

John Vinson

Hello,
Thanks first for any suggestions!
How can I include the count of a particular field from a
query in a form??

The Count operator returns a count of RECORDS, not a count of
"fields".
I have a field with many country names in a query. There
is a repetition of the same country several times.
In my form, I have a combo box with the list of countries.
I want to diplay the number of times the country has
appeared in the field.

Try basing the Combo Box on a Totals query, rather than on the Country
table. Create a Query based on the Country table, left joined to the
table into which you're entering data; select the Country field
*twice* (and the Primary Key if you are using a CountryID rather than
the country name in your table). Make it a Totals query with the Greek
Sigma icon; Group By Country (or CountryID and Country, if you have
the ID), and select Count on the other instance of country. This will
show (e.g.)

Afghanistan 3
Algeria 0
....
United States 31
....
Zimbabwe 0


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

Top