Help PLEEEEAAAASSSEEE
I have a database which reads data from a table in a handscanner database for time in and out of work. I have to link to a payroll system and so unable to use the handscan software to do what I need.
The scanner provides 2 lines of raw data per employee each day. I use the Max of punchfield for the Out time and Min of punchfield for the In time. This is done by a query.
This has been working flawlessly for sometime, however we have introduced a second shift ending after midnight and so there are some difficulties because the out time is now the Min of Punchfield on the following day..... I believe the following rules / code structure will work but I have no idea where to put them or how the 2 Report Dates in the else will work...
If shift = 1 then
PunchDate = ReportDate
InTime = MinofPunchTime
Outtime = MaxofPunchtime
else '(shift=2)
PunchDate = ReportDate
InTime =MaxOfPunchTime
PunchDate=ReportDate+1
OutTime=MinofPunchTime
End if
Is this a function or a procedure and how do I call it from a query. Any suggestions and guidance appreciated.
Thanks
Steve

I have a database which reads data from a table in a handscanner database for time in and out of work. I have to link to a payroll system and so unable to use the handscan software to do what I need.
The scanner provides 2 lines of raw data per employee each day. I use the Max of punchfield for the Out time and Min of punchfield for the In time. This is done by a query.
This has been working flawlessly for sometime, however we have introduced a second shift ending after midnight and so there are some difficulties because the out time is now the Min of Punchfield on the following day..... I believe the following rules / code structure will work but I have no idea where to put them or how the 2 Report Dates in the else will work...
If shift = 1 then
PunchDate = ReportDate
InTime = MinofPunchTime
Outtime = MaxofPunchtime
else '(shift=2)
PunchDate = ReportDate
InTime =MaxOfPunchTime
PunchDate=ReportDate+1
OutTime=MinofPunchTime
End if
Is this a function or a procedure and how do I call it from a query. Any suggestions and guidance appreciated.
Thanks
Steve
Last edited: