"One table with EmpName, Vacation1, Vacation2, Vacation3, ect."
"Employees can have up to six week of vacation"
"But this only works with one date field, not six-date field"
It seems there are six date fields in your table (Vacation1,2,..6) and each of them represents one week of vacation. I wonder how you can use a date field to represent a week of vacation!
Pat is right. You should re-structure your table.
But, if you need an urgent solution, the following may help.
Assuming Vacation1,2,...6 are the six date fields you referred to, the following two queries can help you show the number of matching dates (paste each query to the SQL View of a new query, replacing with the correct table name in the first query):
qry1_VacationUnion:-
SELECT EmpName, Vacation1 as Vacation FROM yourTable WHERE not isnull(Vacation1)
union
SELECT EmpName, Vacation2 FROM yourTable WHERE not isnull(Vacation2)
union
SELECT EmpName, Vacation3 FROM yourTable WHERE not isnull(Vacation3)
union
SELECT EmpName, Vacation4 FROM yourTable WHERE not isnull(Vacation4)
union
SELECT EmpName, Vacation5 FROM yourTable WHERE not isnull(Vacation5)
UNION
SELECT EmpName, Vacation6 FROM yourTable WHERE not isnull(Vacation6);
qry2_VacationCount:-
SELECT Vacation, dcount("Vacation", "qry1_VacationUnion", "Vacation =#" & [Vacation] & "#") AS NumOfEmployees, EmpName
FROM qry1_VacationUnion
ORDER BY Vacation, EmpName;
When you run the second query, the column NumOfEmployees will show the total number for each vacation date along with employee names.
DCount is an inefficient function. It may take time to display the numbers. But it should work.
Or you can run this query, which is much faster but does not show the employee names:
SELECT Vacation, count(*) AS NumOfEmployees
FROM qry1_VacationUnion
GROUP BY Vacation;
Hope this helps.