Entering Race Times

R

Rockaway Tom

I am creating a database to record my daughter's swim times. I don't seem to
be able to save times that are min:sec:hundreths as a time. I can make an
input mask in that format but I am saving it as a text. I am worried that I
won't be able to do calculations later if it is text. I am sure that many
people us Access to save athletic event results. How is it done? I would
appreciate any ideas.

Tom
 
D

Douglas J. Steele

You cannot use the Date/Time data type for your requirements: it doesn't
have that granularity.

Store your times as Long Integers, where 1 = a hundredth of a second. Create
functions to convert from mm:ss.hh to long integer and vice versa.
 
J

Jeff Boyce

Douglas offers one approach...

Another approach would be to save text, and create (as Doug suggests) the
functions you need to "parse" that text into actual numeric values.

The Access Date/Time data type records "point-in-time" data (date & time),
not "duration" data.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dale Fye

A third would be to have three integer fields TimeMinutes, TimeSeconds,
TimeHundreds. Enter these values in three consecutive textboxes on your form.

Then have a function that returns it in the format you want for reports.

PublicFunction fnSwimTimes(Minutes, Seconds, Hundreds) as string

fnSwimTimes = Format(Minutes, "0") & ":" _
& Format(Seconds, "00") & ":" _
& Format(Hundreds, "000")

End function
--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
K

Ken Sheridan

Tom:

You might also want to do arithmetic on the values of course. If you store
the times as a single numeric value, either as hundredths of a second or as
seconds to two decimal places then its easy of course as you can work with
the actual values. With Dale's three integer values you can convert to
seconds to two decimal places for instance with:

swimtime = (minutes*60) + seconds + (hundredths/100)

You can then convert the result back to the a formatted time for display
purposes with:

formattedswimtime = swimtime\60 & _
":" & swimtime Mod 60 & ":" & _
Format((swimtime*100) Mod 100,"00")

The latter expression can also be used to format the values if stored as a
single value of seconds to two decimal places, and the former to convert the
values in three unbound controls to the stored values.

If you do decide to store the values as seconds to two decimal places a
Currency data type is a convenient way of doing this as it has an underlying
precision to four decimal places which suppresses cumulative rounding errors
in calculations. You need to change the column's default formatting from
Currency of course or you'll end up showing the times with a currency symbol
by default.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top