Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Elapsed Time Expression help

Status
Not open for further replies.

TheCleaner

Technical User
Apr 21, 2001
19
US
I'm having A LOT of trouble with this one. I have No programing exp. so please bare with me. I'm creating a Db that tracks my Pilot's duty time. I log in each pilot through a form that stores it in a table. Form there I have the Query sort it how I like (by pilot by month or both) then create the report for it. I use this "module" for the elapsed time expression :

Function GetElapsedTime (interval)
Dim totalhours As Long, totalminutes As Long, totalseconds As _
Long
Dim days As Long, hours As Long, Minutes As Long, Seconds As Long

days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
Minutes = totalminutes Mod 60
Seconds = totalseconds Mod 60

GetElapsedTime = days & " Days " & hours & " Hours " & Minutes & _
" Minutes " & Seconds & " Seconds "

that works perfect to show me how many total hours on duty the pilot had. Now I have to figure out how much rest time there was between his shifts. As I'm putting in a new record (from the form view) how do a right the expression to find the latest record with the same pilot name subtracting his last "endtime" from this new "starttime"?
Sorry so long winded ANY help will be so very appreciated. Thanks J.
 
You have to set up some code that will scroll through a recordset containing one or more records previous to the one being added or saved and one or more subsequent to that record. The gaps will be = OnDutyDateTime - PreviousOffDutyTime ... etc.
It sounds like we're in the same business. I'm doing this now for an air freight company. Email me at jpinson@infoave.net and maybe we can help each other.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top