Timer Issue

D

DS

I have a clock on my form that runs off the timer.
I also have a command button on my form that I would like to change
images in an image field when clicked. The clock works fine. I just
can't get the command button to do as it should. It changes the first
image field and then stops. Here is my code.
Thanks
DS

Private Sub Command21_Click()
Static intSecondsCount As Integer
intSecondsCount = intSecondsCount + 1
Me.ImageWhite.Visible = False
Select Case intSecondsCount
Case 1
Me.ImageWhite.Visible = False
Me.Image1.Visible = True
Case 2
Me.Image1.Visible = False
Me.Image2.Visible = True
Case 3
Me.Image2.Visible = False
Me.Image3.Visible = True
Case 4
Me.Image3.Visible = False
Me.Image4.Visible = True
Case 5
Me.Image4.Visible = False
Me.Image5.Visible = True
Case 6
Me.Image5.Visible = False
Me.Image6.Visible = True
Case 7
Me.Image6.Visible = False
Me.ImageWhite.Visible = True
'Switch Off The Timer
Me.TimerInterval = 0

Case Else
'Kill Timer
intSecondsCount = 0
End Select
End Sub
 
D

DS

DS said:
I have a clock on my form that runs off the timer.
I also have a command button on my form that I would like to change
images in an image field when clicked. The clock works fine. I just
can't get the command button to do as it should. It changes the first
image field and then stops. Here is my code.
Thanks
DS

Private Sub Command21_Click()
Static intSecondsCount As Integer
intSecondsCount = intSecondsCount + 1
Me.ImageWhite.Visible = False
Select Case intSecondsCount
Case 1
Me.ImageWhite.Visible = False
Me.Image1.Visible = True
Case 2
Me.Image1.Visible = False
Me.Image2.Visible = True
Case 3
Me.Image2.Visible = False
Me.Image3.Visible = True
Case 4
Me.Image3.Visible = False
Me.Image4.Visible = True
Case 5
Me.Image4.Visible = False
Me.Image5.Visible = True
Case 6
Me.Image5.Visible = False
Me.Image6.Visible = True
Case 7
Me.Image6.Visible = False
Me.ImageWhite.Visible = True
'Switch Off The Timer
Me.TimerInterval = 0

Case Else
'Kill Timer
intSecondsCount = 0
End Select
End Sub
Ok I almost got it to work. I moved the code to the Timer Event,
tweaked it a bit by adding a hidden text box, when I click on the
command button it sets the value of the hidden textbox to 1 and runs the
code. The problem is that it only does it once, the second time I try
it imagewhite becomes invisible and the whole thing stops, any help
appreciated.
Thanks
DS
 
D

DS

DS said:
Ok I almost got it to work. I moved the code to the Timer Event,
tweaked it a bit by adding a hidden text box, when I click on the
command button it sets the value of the hidden textbox to 1 and runs the
code. The problem is that it only does it once, the second time I try
it imagewhite becomes invisible and the whole thing stops, any help
appreciated.
Thanks
DS
Thanks I figured it out, It was the last line!
DS
 

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