Hours between dates

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I need to track the number of hours an aircraft is in the
hangar. I was thinking of adding a table to our database
which includes the attributes AC, Timein, Timeout.
Another consideration is that the users are not that
bright with computers and cannot type (for the most part)
so I want to minimize the chance of an input error. I
thought of two calendars to handle the date components
but they will not capture the time. I am looking for an
easier alternative to typint in 12/4/2003 5:35:00 PM.
After this is worked out how do I calculate the HOURS
between?

Thanks for the help.
 
Try the DateTime Picker rather than the Calendar.

Use the DateDiff() function to work out the hours.

Check Access / Access VB on the above.
 
To control the users entry of the time, you could use separate combo boxes
with the possible times filled in the drop down list. Set it for Limit to
List = True. You would need 3; one for hours, one for minutes, and one for
am/pm or use 24 hours in the first box instead of the am/pm.

To find the difference in the times, check the DateDiff function in the help
file.

Example:
DateDiff("h", First Date Time, Second Date Time)

Here is an example from the immediate window (Ctrl+G)
?DateDiff("h", #12/20/2003 2:45 pm#, Now)
27

You may actually prefer finding minutes instead of hours then round it back
to hours yourself. In the above, the current time (Now) was actually 5:43
pm, not an exact 27 hours.
 
Back
Top