"Rebecca Smith" <rp*****@pcez.com> wrote in
news:10*************@corp.supernews.com:
I'm building log book to keep track of a racers stats during a
long ultra marathon race. Things such as time on the bike,
time off, H20 intake, electrolytes and the like.
When I say long I mean days! I'd like to have on the input
form, the running number of hours the race has been in
progress. DateDiff only allows me "h" or hours and this won't
take me past 24. I've tried other combinations of formats and
formulas but am just spinning my wheels. I'd sure appreciate
some help on figuring out how many hours the race has been in
progress since the starting gun. Thank you,
Becky
PS - Access 97
the datediff() function will give you all you need.
store the starting datetime of the race, and calculate the
duration to now, I like to use seconds for my calcs
Dim ElapsedTime as double
ElapsedTime = Datediff("s",[race start],now())
To format it as hours and minutes, you need a custom format
routine. Put this in a module and call wherever needed.
public function sec2dur(duration as double) as string
dim hours as integer, mins as integer, secs as integer
hours = int(duration * 3600)
mins = int(duration*60) - hours*60
secs = duration - (hours*3600-mins*60)
sec2dur = format(hours,"000") & ":" & format(mins,"00") & ";" &
format(secs,"00")
end function
I store the start and end time for each lap in a table, and have
a query show the duration of each lap, I can get total times by
having the query select the ElapsedTime and summing that, and
formatting the result.
For your described use, just place the expression in a textbox on
the form, You will need to use the timer event to recalculate
every minute or so.
Bob Quintal