Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with a Condition in a Select Query!!!

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
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.
 
I figured this one, just rebuild the procedure and it started working. Go figure. Thanks any way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top