This is a select query to find a list of employees who have 13 weeks of perfect attendence. Simple right. Holidays are counted as regular days and one or two vacation days or jury duty days are also counted as regular days. Simple right. Here is where it gets tuff, three , four or five vaction days or jury duty days, the week is to be ignored or not counted. I found that Or Exists with an Abs count can get me close. Here is section of my code that I am using:
Or Exists(SELECT Att.EmployeeNumber,
Att.DateWeekStarting
FROM tblAttendence
WHERE ((Abs((Nz(Att.WorkDay1Reason="JurD-A"
Or Nz(Att.WorkDay1Reason="VacD-A")
+(Nz(Att.WorkDay2Reason="JurD-A"
Or Nz(Att.WorkDay2Reason="VacD-A")
+(Nz(Att.WorkDay3Reason="JurD-A"
Or Nz(Att.WorkDay3Reason="VacD-A")
+(Nz(Att.WorkDay4Reason="JurD-A"
Or Nz(Att.WorkDay4Reason="VacD-A")
+(Nz(Att.WorkDay5Reason="JurD-A"
Or Nz(Att.WorkDay5Reason="VacD-A"))=3)
I have an Or(Abs for four and five also. What I would like to do is after the five, say if true then GetNumWeeks(), a VB variable from a module, plus one and RecCnt, the record count from Select, plus zero. Then when the next EmployeeNumber comes up reset GetNumWeeks() back to its default, which is 13 weeks. This will then allow me to count the extra weeks to make up for the ignored weeks. Thanks so much in adavance you folks have been a great help.
Or Exists(SELECT Att.EmployeeNumber,
Att.DateWeekStarting
FROM tblAttendence
WHERE ((Abs((Nz(Att.WorkDay1Reason="JurD-A"
Or Nz(Att.WorkDay1Reason="VacD-A")
+(Nz(Att.WorkDay2Reason="JurD-A"
Or Nz(Att.WorkDay2Reason="VacD-A")
+(Nz(Att.WorkDay3Reason="JurD-A"
Or Nz(Att.WorkDay3Reason="VacD-A")
+(Nz(Att.WorkDay4Reason="JurD-A"
Or Nz(Att.WorkDay4Reason="VacD-A")
+(Nz(Att.WorkDay5Reason="JurD-A"
Or Nz(Att.WorkDay5Reason="VacD-A"))=3)
I have an Or(Abs for four and five also. What I would like to do is after the five, say if true then GetNumWeeks(), a VB variable from a module, plus one and RecCnt, the record count from Select, plus zero. Then when the next EmployeeNumber comes up reset GetNumWeeks() back to its default, which is 13 weeks. This will then allow me to count the extra weeks to make up for the ignored weeks. Thanks so much in adavance you folks have been a great help.