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!

Is There a Way to Convert Part of A Query to VB Code? 2

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
This is the bottonm 1/3 of a query and to get it to work right, I have been told that I must put this part in a module. Ok, but I done really knowe to much about VB at this time. Is there any way, preferablly easy, to convert an SQL query to VB? Here is the part of the query, which does not work in SQL:

Or Exists(SELECT Att.EmployeeNumber,
Att.DateWeekStarting
FROM tblAttendence
WHERE IIf((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)
Or (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")))=4)
Or (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")))=5)),
GetNumWeeks() + 1 And RecCnt +0)

Basically iI am saying that if any one of the WHERE conponents if TRUE then add one to the variable GetNumWeeks() and don't add anything to RecCnt, the record count. I am not even wooried about resetting GetNumWeeks() to the default at this time. I would be eternally greatful to anyone you could help me get through this mess. Thanks in advance.
 
I think I willstart a new thread, Thanks for everything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top