i am not too familiar with sqlx code, and i'm trying to change a few things. i was given a database which has a lot of vba code, and very few queries. just to help me understand what it is doing and how i can tweek it, i'm trying to change some of the code into a query i'm more familiar with. here is the code...
sqlx = "SELECT dbo_tblTime.SSN AS SSNumber, dbo_tblTime.reportDate AS repDate, Sum(datediff('n',dbo_tblTime.timeIn,dbo_tblTime.timeOut)) AS TotalHours," & _
"dbo_tblTime.PayCode AS PayCode, Min(dbo_tblTime.timeIn) AS TimeIn, Min(dbo_tblTime.timeOut) AS TimeOut" & _
" FROM dbo_tblTime WHERE ((dbo_tblTime.SSN)= '" & SSN & "') AND ((dbo_tblTime.reportDate)>= #" & CDate(reqdate) & "# and (dbo_tblTime.reportDate)<#" & CDate(reqdate) + 7 & "#)" & _
" AND ((dbo_tblTime.PayCode)=531) GROUP BY dbo_tblTime.SSN, dbo_tblTime.reportDate, dbo_tblTime.PayCode; "
there is code before and after, but this is the part i need to change. i'm not sure whether or not it's even possible, but if it is i'd sure like some help.
there are 2 times in the dbo_tblTime TimeIn and TimeOut
this one takes the difference of the 2, but there should be 2 of each, a TimeIn from the beginning of their shift, a TimeOut when they go to lunch, a TimeIn when they come back from lunch and a TimeOut when they leave for the day. i need the difference between these 2 times. and be able to pull each of them. unfortunatly i can't email a copy, beacause of security reasons, (social security numbers) sorry.
i don't think i made any sense, but if i did ... thank you.
Smiley
sqlx = "SELECT dbo_tblTime.SSN AS SSNumber, dbo_tblTime.reportDate AS repDate, Sum(datediff('n',dbo_tblTime.timeIn,dbo_tblTime.timeOut)) AS TotalHours," & _
"dbo_tblTime.PayCode AS PayCode, Min(dbo_tblTime.timeIn) AS TimeIn, Min(dbo_tblTime.timeOut) AS TimeOut" & _
" FROM dbo_tblTime WHERE ((dbo_tblTime.SSN)= '" & SSN & "') AND ((dbo_tblTime.reportDate)>= #" & CDate(reqdate) & "# and (dbo_tblTime.reportDate)<#" & CDate(reqdate) + 7 & "#)" & _
" AND ((dbo_tblTime.PayCode)=531) GROUP BY dbo_tblTime.SSN, dbo_tblTime.reportDate, dbo_tblTime.PayCode; "
there is code before and after, but this is the part i need to change. i'm not sure whether or not it's even possible, but if it is i'd sure like some help.
there are 2 times in the dbo_tblTime TimeIn and TimeOut
this one takes the difference of the 2, but there should be 2 of each, a TimeIn from the beginning of their shift, a TimeOut when they go to lunch, a TimeIn when they come back from lunch and a TimeOut when they leave for the day. i need the difference between these 2 times. and be able to pull each of them. unfortunatly i can't email a copy, beacause of security reasons, (social security numbers) sorry.
i don't think i made any sense, but if i did ... thank you.
Smiley