smods
asked on
Capturing minutes and seconds only?
Hi all,
How would I do this? I have a time field which I have set the format to nn:ss but entering 05:45 becomes 05:45:00 - How do I get around this?
Regards
Chris
How would I do this? I have a time field which I have set the format to nn:ss but entering 05:45 becomes 05:45:00 - How do I get around this?
Regards
Chris
enter it as 00:05:45?
you might need to give more detail? could you convert your time to just seconds and store it as an integer?
Chris,
Try this format:
=Format(Now(),"m:s")
Sincerely,
Ed
Try this format:
=Format(Now(),"m:s")
Sincerely,
Ed
ASKER
Hi guys,
Sorry I wasn't clear! It's for capturing an average transaction time. If possible I wouldn't want to enter it as 00:05:45
Regards
Chris
Sorry I wasn't clear! It's for capturing an average transaction time. If possible I wouldn't want to enter it as 00:05:45
Regards
Chris
There isn't any way of entereing just minutes and seconds into a time field. As you have found , Access will always treat such an entry as hours and minutes.
You can use the technique suggested by Sudonim or you can use two fields, one for minutes and one for seconds and then build the time value in code.
Or you can use the afterupdate event of the entry and rebuild the time using..
me.textboxname= timeserial(0, Hour(me.textboxname), minute(me.textboxname))
You can use the technique suggested by Sudonim or you can use two fields, one for minutes and one for seconds and then build the time value in code.
Or you can use the afterupdate event of the entry and rebuild the time using..
me.textboxname= timeserial(0, Hour(me.textboxname), minute(me.textboxname))
ASKER
could you convert your time to just seconds and store it as an integer?
So would I enter the time but in seconds? The two text box solutions doesn't sound ideal. How would I do this?
I am sorry Chris for my first post.
Yeap, I agree with Peter. Date/Time field allows only entry for a day and a time.
If you want to view elapsed time and showing it in minute:seconds then you change the date/time field into a number and enter the elapsed time in seconds. Then, calculate the value into minute:second for display purposes.
Ed
Yeap, I agree with Peter. Date/Time field allows only entry for a day and a time.
If you want to view elapsed time and showing it in minute:seconds then you change the date/time field into a number and enter the elapsed time in seconds. Then, calculate the value into minute:second for display purposes.
Ed
ASKER
Thanks Ed. How would I do that?
Regards
Chris
Regards
Chris
Chris,
Here it is:
Private Sub t1_AfterUpdate()
Me.MinSec = Me.t1 / 86400
End Sub
t1 = Field name of where you enter the elapsed values in seconds
MinSec = Unbound field that display the minutes:seconds
You need to format the MinSec field with "m:s".
Sincerely,
Ed
Here it is:
Private Sub t1_AfterUpdate()
Me.MinSec = Me.t1 / 86400
End Sub
t1 = Field name of where you enter the elapsed values in seconds
MinSec = Unbound field that display the minutes:seconds
You need to format the MinSec field with "m:s".
Sincerely,
Ed
Replace Me.MinSec = Me.t1 / 86400 witht the code below instead:
Me.MinSec = Int(Me.t / 60) & ":" & (Me.t - (60 * Int(Me.t / 60)))
Ed
Me.MinSec = Int(Me.t / 60) & ":" & (Me.t - (60 * Int(Me.t / 60)))
Ed
Chris,
Pratima's post at ID:34941778 provided the codes I posted above. You can refer that link for more info.
Ed
Pratima's post at ID:34941778 provided the codes I posted above. You can refer that link for more info.
Ed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not to use something like this?
DB26835639.accdb
DB26835639.accdb
ASKER
Works like a charm!
Many thanks!!
Chris
Many thanks!!
Chris
You are welcome!
/gustav
/gustav
nice work all.
that will teach me to take a long lunch break :)
that will teach me to take a long lunch break :)