How do you count occurrence of each value in a field in Access 2007?
Sunday, December 27th, 2009I am designing an Access 2007 database that will, among other things, track attendance. In the future I will need to be able to run reports listing things like who hasn’t been to the last 5 meetings. Right now I need to be able to create a query to tell me who has attended less than 3 meetings.
At the moment the data is organized in two forms. The Attendance form contains the following fields: attID, attDate, attPerson, and others not related to this problem. The attPerson field relates to the primary key in my Person table, which includes, among unrelated data: personID, personNameLast, personNameFirst.
How do I create a query (preferably without using SQL) to count the number of meetings any person has been to? Can it be done with this set up? If not, how should I destine my database to allow me to do this?
Thank you for your help.
The easiest way (imho) is to do this via SQL:
SELECT attPerson, COUNT(*) AS Meetings
FROM Attendance
GROUP BY attPerson;
You should be able to build this via the query designer interface by doing the following:
Field 1 – Field: attPerson; Table: Attendance; Total: Group By
Field 2 – Field: Meetings:Count(*); Table <blank>; Total: Expression
Hope this helps!