1. Open the Form in Design View
  2. Click on the [End Time] Field
  3. Click on the Property Sheet icon on the Toolbar to display the Property Sheet of the Field.
  4. Find the Lost Focus Property and click on it
  5. Select [Event Procedure] from the drop down control and click on the build (...) button to open the VBA Module.
  6. A skeletion of a VBA routine will be inserted in the module.
  7. Write the following line of VBA Code:
me![Trip Time] = [End Time]-[Start Time]
After you enter the [End Time] and the insertion point is moved out of the field the [Trip time] will be calculated and inserted into the [Trip Time] Field. To display the time in hh:nn format set this format string in the Format Property of the [Trip Time] field.

Internaly the time is stored as a real number like 0.5 for 12:00 noon, the format string formats in the way you want it to be displayed.

If the Date is likely to change between Trip Start and End Times then you must modify the above statement as below:

Me![Trip Time] = ([End Date]+[End Time]) - ([Start Date]+[Start Time])
CSUjr, shabbir likes this