CountDown with format 00:00:00 in access

J

jonesfranckandi

hi there everyone. I know this topic has been going on for some time
now. but really I need your help. I wish to create a countdown in an
access form so that when the timer is up a message box pops up and says
time is up. You see I wish the count down to be in hours, minutes and
seconds.
Something like 00:40:00 and when the countdown starts it goes 00:39:59
and so on. I know how to do it with seconds only but no with this
format.Can anyone help me please!!. I really need it for my coursework.
An example with a download would be very helpful.
Thanks in Advance!!!!
 
D

Douglas J. Steele

Assuming you've got a text box txtTimer on your form, when you want to start
the timer, set

Me.TimerInterval = 1000
Me.txtTimer = Format(#00:40:00#, "hh:nn:ss")

For the form's Timer event, put:

Private Sub Form_Timer()
Dim dtmCurr As Date

dtmCurr = CDate(Me.txtTimer)
If dtmCurr > 0 Then
Me.txtTimer = Format(DateAdd("s", -1, dtmCurr), "hh:nn:ss")
Else
Me.TimerInterval = 0
Me.txtTimer = Null
MsgBox "Time's up!"
End If
End Sub
 
J

jonesfranckandi

Thanks a Lot!!!! man you are great. I don't know how to thank you. I
owe you one. Maybe I will be able to help you another time if you need
help.
 
J

jonesfranckandi

Thanks a Lot!!!! man you are great. I don't know how to thank you. I
owe you one. Maybe I will be able to help you another time if you need
help.
 
J

John Vinson

hi there everyone. I know this topic has been going on for some time
now. but really I need your help. I wish to create a countdown in an
access form so that when the timer is up a message box pops up and says
time is up. You see I wish the count down to be in hours, minutes and
seconds.
Something like 00:40:00 and when the countdown starts it goes 00:39:59
and so on. I know how to do it with seconds only but no with this
format.Can anyone help me please!!. I really need it for my coursework.
An example with a download would be very helpful.
Thanks in Advance!!!!

Ummm... since it's for your coursework, with the implication that
you're supposed to do it yourself, I'll give a hint rather than an
answer.

Count in seconds.

Use the MOD and integer-divide operator \ to generate a text string
for display from the seconds.

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