Need to resume timer when 1 form closes and start timer again on other form
frmregister is the form that is open and when it closes I need frmLogin timer to start again.
The TimeCount should be set to 30 seconds
TimerInterval set to 1000
TimeCount = TimeCount + 1
I think this is correct
Resume Timer
-
- Administrator
- Posts: 76686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Resume Timer
Dim TimeCount As Long
'Declare a Form Global variable to hold the
'seconds expired since Form was opened.
'Declare a Form Global variable to hold the
'seconds expired since Form was opened.
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Resume Timer
Code: Select all
Private Sub Form_Timer()
'Increment the TimerCount variable by 1
TimeCount = TimeCount + 1
'Display the current seconds remaining in the
'small Label control located in the upper right
'corner of the Form.
Me.Cnter.Caption = 20 - TimeCount
'If the Seconds Counter (TimerCount) is now equal
'to 61 seconds then Close the Password Entry Form.
If TimeCount = 21 Then
DoCmd.quit
End If
Private Sub Form_Unload(cancel As Integer)
'When the Form closes or is put into Design view
'then Zero the Form's TimerInteval. If you don't
'it can cause some strange things to happen.
Me.TimerInterval = 0
End Sub
-
- Administrator
- Posts: 76686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Resume Timer
I assume that the code that you posted is in the code module of frmLogin.
If so, the variable TimeCount will not be available in the code module of frmRegister.
To correct this, remove the declaration of TimeCount from frmLogin and place it in a standard module, near the top:
Public TimeCount As Long
If you want to reset the count to restart it, you should use
TimeCount = 0
If so, the variable TimeCount will not be available in the code module of frmRegister.
To correct this, remove the declaration of TimeCount from frmLogin and place it in a standard module, near the top:
Public TimeCount As Long
If you want to reset the count to restart it, you should use
TimeCount = 0
Regards,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Resume Timer
Did you mean adding all of the code to the module?
-
- Administrator
- Posts: 76686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands