Jump to content

Calculating Time in MS Access


quadinfinity

Recommended Posts

:hello: I need help with a problem. I have already reviewed Microsofts "On time and how much has elapsed" article and it is helpful, but not based on how my data is arranged. I am actually trying to do a calculation based on a form that was created by another programmer. Here is my dilemma:

The form is based off of a table and each "time" field has it's own column. So, for example, if you traveled from Point A to Point B, the DepartTime1 may be 1pm and the ArriveTime1 may be 3pm. Then if you travel from Point B to Point C within that same day there is a DepartTime2 field and a ArriveTime2 field and so on. There are Five depart and arrive time fields per day (with 7 days for the week).

If I use the formula that is in the MS article, it doesn't account for different columns for each time. According to their example, Time is one column and if you do multiple time, it is showed in it's own row, which is probably how it should be done, but then again, I didn't design this and it wasn't originally designed to have the need to calculate time.

Given the following example, how can I calculate the total time for one day with, possibly, multiple time fields and calculate the "Grand Total" of time for multiple days? And how would I code it to not account for a Time field if it's empty?

03/03/2008

Depart From Time Arrive To Time

Chicago 10:00 AM (field name Time1) SPRFLD 12:30 PM(field name Time2)

SPRFLD 05:00 PM (field name Time3) CHICAGO 07:45 PM(Field name Time4)

I need total travel time for 03/03/2008 (which should come out to 5:15)

Thank you for all your help in advance...

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...