Count Field Values in Tables (1 Viewer)

lucour

Registered User.
Local time
Today, 00:31
Joined
Mar 7, 2001
Messages
60
Hi,

This is probably somewhat easy. I have an Access database that is being used for visitors to sign in and out of our Data Center. The table is called tblCompRoomLog. In it is a field called InName. This lists the names of the visitors that have visited the Data Center. I want to query this field, group all like names together, and then count them. The purpose of this is to show how many times a person has visited. So if there are 5 different record entries for "Bob Smith", I want to able to group this and then count how many times he has visited. From this, I want to create a status report. It will look like:

Bob Smith has visited the Data Centre 5 times this month
Ken Campbell has visited the Data Centre 23 times this month
Joe MacNeil visited the Data Centre 41 times this month

Thanks !
 

dcx693

Registered User.
Local time
Yesterday, 19:31
Joined
Apr 30, 2003
Messages
3,265
If your report will be just that simple, it might be easiest for you to use a simple DCount function in a text control on your report. You can use a formula like this:
=DCount("InName","tblCompRoomLog","[InName]='Bob Smith'"

A step up in complexity, but better in design, to create a totals query on the tblCompRoomLog table where you group by InName and create a calculated count field. Then save the query, and base your report on it.
 

lucour

Registered User.
Local time
Today, 00:31
Joined
Mar 7, 2001
Messages
60
Thanks very much dcx693 ! I used your second suggestion of creating a Totals query whereby I used a Group By on the name field and a Count in a calculated field. It worked perfectly and is exactly what I need.

Thanks again !
 

Users who are viewing this thread

Top Bottom