G
Guest
I have a Form that uses a Query that calculates the date difference between
the Start Time on Duty and the End Time on Duty. My start and end times are
entered as military time, and the result shows in military time.
My query Calculated field is:
TotalHoursOnDuty: DateDiff("n",[StartTimeOnDuty],[EndTimeOnDuty])
This query field has a format property of FIXED.
My Form Text Box Control shows:
=[TotalHoursOnDUty]\60 & Format([TotalHoursOnDuty] Mod 60,"\:00")
The text box has a format property of SHORT TIME.
These statements are fine for hours in the same day. However, when I enter a
start time of 2300 and and end time of 0700, the result should be 8 hours on
duty. But the result showing in the query is -960.00 and -16:00 on the form.
I know there is a logic statement you can use about calculationg time
difference across midnight. It is:
Format([StartTimeOnDuty] -1 -[EndTimeOnDuty], "Short Time")
My problem is I can't figure out WHERE to use this format statment. Does it
go in the query where the result is the numeric value? Or does it go in the
form where I have changed the numeric value to a time format? Do I add it in
a Format Property Field or the Control Source on the Form?
I have tried putting this several places, but Access interprets the
statement wierdly. I need help getting the statement into the correct
location.
Or .... am I going about this incorrectly???
Thank you for your help with my delima.
the Start Time on Duty and the End Time on Duty. My start and end times are
entered as military time, and the result shows in military time.
My query Calculated field is:
TotalHoursOnDuty: DateDiff("n",[StartTimeOnDuty],[EndTimeOnDuty])
This query field has a format property of FIXED.
My Form Text Box Control shows:
=[TotalHoursOnDUty]\60 & Format([TotalHoursOnDuty] Mod 60,"\:00")
The text box has a format property of SHORT TIME.
These statements are fine for hours in the same day. However, when I enter a
start time of 2300 and and end time of 0700, the result should be 8 hours on
duty. But the result showing in the query is -960.00 and -16:00 on the form.
I know there is a logic statement you can use about calculationg time
difference across midnight. It is:
Format([StartTimeOnDuty] -1 -[EndTimeOnDuty], "Short Time")
My problem is I can't figure out WHERE to use this format statment. Does it
go in the query where the result is the numeric value? Or does it go in the
form where I have changed the numeric value to a time format? Do I add it in
a Format Property Field or the Control Source on the Form?
I have tried putting this several places, but Access interprets the
statement wierdly. I need help getting the statement into the correct
location.
Or .... am I going about this incorrectly???
Thank you for your help with my delima.