Time

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I have a table that I would like to have a time field to
record minutes / seconds. It is to record the length of a
conversation. We never have had a conversation last more
than 20 minutes and 90% go under 5 minutes. For the user
to enter in the time, they have to enter 0:5:45 (for five
minutes, 45 seconds). I would like the user to only have
to enter in 5:45. The field is formatted as a data type of
Date/Time with a format of n:ss.

Thanks in advance.

Jason
 
I think it is a mistake to enter time durations into a date/time field. I
would use a single or double precision number to store the number of
minutes. 5:45 would be entered as 5.75. This would be much easier to enter
and is much more generally accepted.
 
But what happens when the time is 4:17 which would be
4.2833. The user would need to calculate the fraction each
time they entered a time (could be as many as 75-100
entries per day)?

If I choose this route, any way of making it easier on the
user?

Thanks in advance,

Jason
 
You can always keep your user entry separate from what actually gets stored
in a table. For instance, you could use an unbound text box that allows
entry of 4:17 and in the afterupdate event, calculates the fraction value
and updates the bound field.
 
But what happens when the time is 4:17 which would be
4.2833. The user would need to calculate the fraction each
time they entered a time (could be as many as 75-100
entries per day)?

If I choose this route, any way of making it easier on the
user?

One way is to have a form with three textboxes: two visible but
unbound, minutes and seconds; and one bound but invisible, bound to
the fractional time. In the AfterUpdate event of the unbound controls
put code like

Private Sub txtMin_AfterUpdate()
Me!txtDuration = NZ(Me!txtMin) + NZ(Me!txtSec) / 60.
End Sub

and in the Form's Current event put

Private Sub Form_Current()
Me!txtMin = CInt(Me!txtDuration)
Me!txtSec = 60*Me!txtDuration MOD 60
End Sub
 
Back
Top