Need help in writing code for special project

  • Thread starter Thread starter Richard Crum
  • Start date Start date
R

Richard Crum

I am developing a database and am stumped on one major problem. My database
has three fields that are: Date/Time of Incident, Date/Time of Request and
Date/Time of Arrival. All times are in 24 hr. format. I need to calculate
the elapsed time between Date/Time of Incident and Date/Time of Request and
than elapsed time between Date/Time of Request and Date/Time of Arrival,
indicating total hrs. and minutes. Would anyone care to provide me with the
code and steps to accomplish this task.
 
Richard said:
I am developing a database and am stumped on one major problem. My
database has three fields that are: Date/Time of Incident, Date/Time
of Request and Date/Time of Arrival. All times are in 24 hr. format.
I need to calculate the elapsed time between Date/Time of Incident
and Date/Time of Request and than elapsed time between Date/Time of
Request and Date/Time of Arrival, indicating total hrs. and minutes.
Would anyone care to provide me with the code and steps to accomplish
this task.

Time durations need to be done using the DateDiff() function to the smallest
increment you care about (in this case minutes) and then you have to do the math
yourself to get hours and minutes displayed as a string.

For example...

lngMinutes = DateDiff("nn", [Date/Time of Incident], [Date/Time of Request])

....returns the number of minutes between the two DateTimes and then you can take
that result and display it as...

lngMinutes\60 & ":" & Format(lngMinutes mod 60, "00")
 
Back
Top