TheCleaner
Technical User
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.
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.