How enter elapsed time. eg 3 mins 27.99 seconds in access/xcell

  • Thread starter Thread starter Grizz
  • Start date Start date
G

Grizz

I want to enter an elpsed time into access eg 3mins 25.87 seconds. Have tried
custom format but keep schanging to date format
 
I want to enter an elpsed time into access eg 3mins 25.87 seconds. Have tried
custom format but keep schanging to date format

A Date/Time field type is not going to work for you here: it's limited to a
granularity of one second, and doesn't handle fractions of a second. In
addition, Date/Time values work best to store specific points in time, not
durations.

I'd suggest using a Double Float number datatype to store elapsed seconds (and
fractions) - e.g. 385.87 seconds. You can display and enter this as minutes
and seconds by using one bound textbox and two unbound ones, for minutes and
seconds, with a bit of VBA code in their AfterUpdate events to fill in the
bound control, and some code in the form's Current event to translate the
duration into minutes and seconds:

Private Sub Form_Current()
Me!txtMin = Me!txtDuration \ 60
Me!txtSec = Me!txtDuration - 60*(Me!txtDuration \ 60)
End Sub
 

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

Back
Top