Maybe I am not explaining it properly:
Here is my table:
Student id Autonumber (key)
Student Name Text
Camp Week1 Date/Time
Camp Week2 Date/Time
Camp Week3 Date/Time
Camp Week4 Date/Time
Camp Week5 Date/Time
Again:
THIS TABLE STRUCTURE IS WRONG.
You're "Committing spreadsheet upon a table". You're making this query a
*great deal harder to write* by storing one piece of data - a camp week - in
five different places.
A better structure would have two tables in a one to many relationship:
Students
StudentID <Autonumber Primary Key>
LastName
FirstName <do split the name into at least two fields so you can search or
sort by either name>
CampWeeks
StudentID <Long Integer, foreign key to Students>
WeekNo <integer, 1 to 5 at present, may change at some point>
WeekDate <date/time>
YOu would add *five records* - using a continuous subform for convenience -
rather than five fields.
What would be the syntax to find:
The number of students that have a Camp Week date of July 7, 2008
The number of students that have a Camp week date of July 14, 2008
The number of students that have a Camp week date of July 21, 2008
etc .....
With your current structure you will need a Query based on another Query.
First create a UNION query to normalize the data. You 'll need to go into SQL
view to do this:
SELECT [Student ID], [Camp Week1] AS CampWeek FROM yourtable
WHERE [Camp Week1] IS NOT NULL
UNION ALL
SELECT [Student ID], [Camp Week2] FROM yourtable
WHERE [Camp Week2] IS NOT NULL
UNION ALL
SELECT [Student ID], [Camp Week3] FROM yourtable
WHERE [Camp Week3] IS NOT NULL
UNION ALL
SELECT [Student ID], [Camp Week4] FROM yourtable
WHERE [Camp Week4] IS NOT NULL
UNION ALL
SELECT [Student ID], [Camp Week5] FROM yourtable
WHERE [Camp Week5] IS NOT NULL;
Save this as qryAllWeeks. Then create a second query:
SELECT Count([Student ID]), CampWeek
FROM qryAllWeeks GROUP BY CampWeek
WHERE <optional criteria>