assign button to start a countDown then stop It!

  • Thread starter Thread starter jonesfranckandi
  • Start date Start date
J

jonesfranckandi

Hi, everyone!

I know this may sound silly,but is it possible to assign to start a
countdown. I have a form where I have a box whee when user enters a
time the counter starts. but I want a button to start the counter
instead of the form itself. How can you do it?

anyone any ideas?

Thanks in advance!!!!!!!!!!
 
Thank you Rick. You are the man!
Many Thanks!
Rick said:
How about this:

Private Sub cmdGO_Click()
Me.OnTimer = "[Event Procedure]"
Me.TimerInterval = 1000
End Sub

Private Sub Form_Load()
Me.OnTimer = ""
Me.txtCountDown=0
End Sub

Private Sub Form_Timer()
If Me.txtCountDown.Value = 0 Then
Me.OnTimer = ""
MsgBox "All Done!", vbInformation, "Time Check"
Else
Me.txtCountDown.Value = Me.txtCountDown.Value - 1
End If
End Sub

Hi, everyone!

I know this may sound silly,but is it possible to assign to start a
countdown. I have a form where I have a box whee when user enters a
time the counter starts. but I want a button to start the counter
instead of the form itself. How can you do it?

anyone any ideas?

Thanks in advance!!!!!!!!!!
 
I'm going to make some assumptions. On your Form, I'm going to assume you
have a Text Field named "Number" with a corresponding label "Enter a Number:".
Then you have a Command Button named "cmdButton".

For the Command Button create an On Click Event Procedure that looks like
this:

Private Sub cmdButton_Click()

Me.TimerInterval = 1000

End Sub


Then Create On Timer Event Procedure that looks like this:

Private Sub Form_Timer()

If Me.Number <> 0 Then
Me.Number = Me.Number - 1
Else
Me.TimerInterval = 1000
End If

End Sub

--
Ruel Cespedes
Sr. Programmer Analyst
(e-mail address removed)

Message posted via AccessMonster.com
 
Your welcome!

Ruel

--
Ruel Cespedes
Sr. Programmer Analyst
(e-mail address removed)

Message posted via AccessMonster.com
 
Back
Top