If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Total working hours problem if it start from 30 at night and ends onthe 31 morning
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 |
#2
|
|||
|
|||
Total working hours problem if it start from 30 at night and ends on the 31 morning
The problem is that you're strictly using Time In and Time Out. You really
should have Date/Time In and Date/Time Out. For the meantime, take a look at http://www.mvps.org/access/datetime/date0008.htm at "The Access Web" -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Tia" wrote in message ... 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 |
#3
|
|||
|
|||
Total working hours problem if it start from 30 at night and ends on the 31 morning
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 "Tia" wrote in message ... 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 |
#4
|
|||
|
|||
Total working hours problem if it start from 30 at night and ends on the 31 morning
Or this:
If StartTime StopTime Then LapsedHours = (DateDiff("n",StartTime,StopTime) + 1440)/60 Else LapsedHours = DateDiff("n",StartTime,StopTime)/60 End If -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200911/1 |
Thread Tools | |
Display Modes | |
|
|