View Full Version : Calculating travel times between jobs


hiaber
01-07-2010, 10:02 PM
I'm building a time sheet for my business - I'm a crane truck driver - I track my time as such:

Customer | Arrive time | Depart time |expr1 (hidden) _| Stop time___ |
Cust 1___ | 09:00 ___ | 09:35_____ |<value in mins> | ##hrs ##min. |
Cust 2___ | 10:10 ___ | 10:50_____ |<value in mins> | ##hrs ##min. |
Cust 3___ | 11:05 ___ | 11:30_____ |<value in mins> | ##hrs ##min. |

** underscores "_" are only shown to align columns in this post**

I've managed to create a query that gives me the total time on each site:
Expr1: DateDiff("n",[Arrive time],[Depart time]) -->>
Stop time: Int([expr1]/60) & " Hrs " & Format([expr1] Mod 60,"00") & " min. "

What I need to do is get a calculation of the travel time between each stop - ie: the amount of time between 9:35 and 10:10, and 10:50 and 11:05.

I'm a bit of a greenhorn when it comes to access, I'm using Acess 2007.

Is this possible with MS Access?

Any help or insight would be extremely appreciated!

and yes, you may have seen this posted on other access forums - i'm yet to get a reply, so i thought i'd post in a couple different places!

pbaldy
01-08-2010, 07:06 AM
It can be done, but you need some method to get the value from the previous record into the current record to do the calculation. Here's one:

http://www.baldyweb.com/PrevValue.htm

hiaber
01-08-2010, 07:45 PM
Thanks Paul - I've been working with those formulas to try and get them to work for me, and I think they will - just haven't had any luck yet - I'm trying to figure out what data to use in place of the carnum column for my purposes - will let you know how i fare

--jhb

hiaber
01-08-2010, 10:01 PM
Paul - i got it to work - thanks again for your help

pbaldy
01-08-2010, 10:07 PM
No problemo, and welcome to the site by the way.