PLEASE...any help will be appreciated on this matter!!!! This is a repost.
I have a complicated problem...
I am trying to write an SQL statement, but I do not know how to establish the criteria for my statement...
Here is the basic information to start with:
What I need to accomplish is this:
1. For each EmpFile#, I need to count the number of times the following Codes occur: 21, 22, and 23. (I.e. if EmpFile# has Code 21 3 times and Code 22 2 times, I need for it to show a grand total of 5 times.)
2. If any combination of the 3 Codes occur 4-7 times, then I want a MsgBox to generate.
The criteria for the SQL statement is what's doing my head in...I'm at a loss as to how I need to write it.
Thanks so much in advance for any assistance given...
Kmkland
I have a complicated problem...
I am trying to write an SQL statement, but I do not know how to establish the criteria for my statement...
Here is the basic information to start with:
Code:
SELECT tblEmpInfo.[EmpFile#], tblEmpInfo.LName, tblAbsences.Date_of_Absence, tblAbsences.Code
FROM tblEmpInfo INNER JOIN tblAbsences ON tblEmpInfo.[EmpFile#] = tblAbsences.[EmpFile#]
WHERE (((tblAbsences.Date_of_Absence)>=Date()-365))
ORDER BY tblAbsences.Date_of_Absence;
What I need to accomplish is this:
1. For each EmpFile#, I need to count the number of times the following Codes occur: 21, 22, and 23. (I.e. if EmpFile# has Code 21 3 times and Code 22 2 times, I need for it to show a grand total of 5 times.)
2. If any combination of the 3 Codes occur 4-7 times, then I want a MsgBox to generate.
The criteria for the SQL statement is what's doing my head in...I'm at a loss as to how I need to write it.
Thanks so much in advance for any assistance given...
Kmkland