Total working hours problem if it start from 30 at night and ends onthe 31 morning

T

Tia

Dear all, i am using this to get the total wroking hours per day
TOTAL WORKING HOURS PER DAY: DateDiff("n",[TIME IN],[TIME OUT]+DateDiff
("n",[TIME IN 2],[TIME OUT 2]))/60

It is working perfectly until i have this
Employee Name Day Date Time Clock
In/OUT
Tia Kareem Fri 10/30/2009 5:59pm IN
Tia Kareem Sat 10/31/2009 3:27am OUT

IF i will use the same expression i will be getting total working
hours per day : -14.53
Employee Name Date IN
OUT Total Working Hours
Tia Kareem 10/30/2009 5:59pm
3:27am -14.53
Jason 10/30/2009 9:00 am
18:00pm 9

How can i get the total of 09:47 per day if they worked from 30 till
31 in one shift?

Best Regards
 
J

Joe

Try This:

Dim sngTotal As Single
Dim sngDailySum As Single

sngTotal = DateDiff("n", [txtIn], [txtOut]) / 60 'Calculate the minutes
and divide by 60

If Sgn(sngTotal) = -1 Then 'If the number is negative
txtOut = DateAdd("d", 1, txtOut) 'add one day
sngTotal = DateDiff("n", [txtIn], [txtOut]) / 60
End If

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top