
Originally Posted by
Sethu
Inappropriate location of End If? Try this
Private Sub Timer2_Timer()
If mTime <= 3 Then
mTime = mTime + 1
Timer2.Enabled = True
End If
If mTime >= 4 Then
Timer2.Enabled = False
Me.Visible = False
frmCleo.Show
frmCleo.AddBonusWinnings
End If
End Sub
No, not really.....you SURELY don't need the "Timer2.Enabled = True" within the timer itself!
However, the original COULD be simplified like this (but his issue is that he claims it is never truly Enabled from the call on the other form---so THEREIN would lie the reall issue, I believe).
Code:
Private Sub Timer2_Timer()
mTime = mTime + 1 'As OP stated, this variable was declared as global.
If mTime >= 4 Then 'would eliminate the greater than sign, but because it is global to the form, not sure if this timer would be called more than once...OR, if called multiple times, OP should reset mTime to 0
Me.Visible = False
frmCleo.Show
frmCleo.AddBonusWinnings
Timer2.Enabled = False 'I prefer to 'stop' the timer after I do all the things I want it to do.....
End If
End Sub