Click here to Skip to main content
15,891,645 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using MS access 2010.

I need to get the InTime and OutTime between the timing 5am today till 5am tomorrow. Because some employee will come by today morning,say,10:00 am and may leave the office by next day morning 2:00 am. so I need to calculate his/her intime and outtime.

The query used is:

SELECT DateValue(Trans.Dt) AS DateOfAttendance, Format(Min(Trans.Dt) ,"MM/dd/yyyy HH:mm:ss") AS InTime, Format(Max(Trans.Dt),"MM/dd/yyyy HH:mm:ss") AS OutTime, EmpID FROM Trans WHERE (DateValue(Trans.Dt)=date()) GROUP BY DateValue(Trans.Dt),Trans.EmpID;

Thanks in Advance!!!
Posted
Updated 8-Sep-14 22:51pm
v3
Comments
Richard Deeming 5-Sep-14 9:35am    
sai sruthi 12-Sep-14 8:27am    
The given link has many solutions and the query
WHERE
(DateValue(Trans.Dt) in ('8/25/2014') And Format(Trans.Dt,"Short Time") >= '05:00')
Or
(DateValue(Trans.Dt) in ('8/26/2014') And Format(Trans.Dt,"Short Time") <= '05:00')

is working and it gives output as intime and outtime for 8/25/2014 separately and for 8/26/2014 separately.
But I need for example,
empid=0097 has intime=8/25/2014 10:52:44 and OutTime=8/26/2014 03:15:22
i.e) the employee has come by 25th of august and left by 26th of august.
but the case is that he may have many checkin and checkout for the same day.
the problem is that the query retrieves the last checkout for that day(before 12:00 AM) and the checkin after 12:00 AM as first checkin for next day.

please solve this problem

Thanks in Advance!!!

1 solution

You have been given a link to a solution, please go and try it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900