How do I format time field for 100 minute format

G

Guest

Trying to set up a time field to accept time clock input in 100 minute or
fractional format; i.e. 12:30 p.m. would be 12:50; 12:45 p.m. would be 12:75
etc...
 
K

kingston via AccessMonster.com

AFAIK, there is no such data type built into Access. You'd simply use a
Single or Double and convert or reformat. So, your user might enter 03.50
and PM. Then you'd take the fractional portion of the input and multiply it
by 60 to arrive at :30.
 
J

John Vinson

Trying to set up a time field to accept time clock input in 100 minute or
fractional format; i.e. 12:30 p.m. would be 12:50; 12:45 p.m. would be 12:75
etc...

A Date/Time field will not let you do that, at least not with native
Access functionality. I'd be really reluctant to use the standard
sexidecimal colon format for this grossly non-standard time
representation though! Wouldn't 12.50 be less ambiguous and more
reasonable?

What you could do is use an unbound textbox on the Form, with an input
mask 90.00 to allow entry of a decimal number. You could use code in
its AfterUpdate event like

Private Sub txtDecimalTime_AfterUpdate()
If Not IsNull(Me.txtDecimalTime) Then
If Me.txtDecimalTime < 0 Or Me.txtDecimalTime > 24 Then
Msgbox "Enter a valid time", vbOKonly
Else
Me.txtWorkTime = DateAdd("n", 60*Me.txtDecimalTime, #0:00#))
End If
End If
End Sub

John W. Vinson[MVP]
 

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