Time calcuation in a form?

  • Thread starter Thread starter jackrobyn1
  • Start date Start date
J

jackrobyn1

I have a form that has time fields [Timefrom] and [Timeto] and [Total]. The
times represent the period of time a vehicle was off the road. eg. 14:20pm -
15:35pm, should read 1:15 in the [Total] field, i want to set the [Total]
default value to work this out so i dont have to enter it. I've tried
entering things into the field/ properties/ defualt value, found on here but
cant get a good result. Should the field be a text box or a time field? that
has my table as its source? I want the Total lost time to be entered onto my
table also. Sorry if this seems simple but i'm a complete beginner. My table
is called LostMilesTBL if it helps.
 
The Date/Time data type is used to display "point-in-time" information, not
"duration".

You'll need to use a text type control, and you'll need to build a parsing
routine.

Take a look at the DateDiff() function to find the difference (hint: use
"minutes"), then use your parsing routine to divide minutes by 60 (the
"hours" part) and the Mod() function (to find remainder--the "minutes" part)
and finally to concatenate them with the proper punctuation.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top