Need help in writing code for special project

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.
 
R

Rick Brandt

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top