Code Runs Twice

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I have this code that works fine except for the first time the for is
opened...whenever the form is opened and I click on the image the code
runs twice making Line16 2" instead of 1". Any insight appreciated.
Thank you
DS


Private Sub Image1_Click()
Dim lngC As Long
Me.TextD = Me.TextD & "1"
lngC = Len(Me.TextD)
Select Case (lngC)
Case 1
Me.Line16.Visible = True
Me.Line16.Width = 1 * 1440
Case 2
Me.Line16.Visible = True
Me.Line16.Width = 3 * 1440
Case 3
Me.Line16.Visible = True
Me.Line16.Width = 5 * 1440
Case 4
Me.Line16.Visible = True
Me.Line16.Width = 7 * 1440
End Select
End Sub
 
DS said:
I have this code that works fine except for the first time the for is
opened...whenever the form is opened and I click on the image the code
runs twice making Line16 2" instead of 1". Any insight appreciated.
Thank you
DS


Private Sub Image1_Click()
Dim lngC As Long
Me.TextD = Me.TextD & "1"
lngC = Len(Me.TextD)
Select Case (lngC)
Case 1
Me.Line16.Visible = True
Me.Line16.Width = 1 * 1440
Case 2
Me.Line16.Visible = True
Me.Line16.Width = 3 * 1440
Case 3
Me.Line16.Visible = True
Me.Line16.Width = 5 * 1440
Case 4
Me.Line16.Visible = True
Me.Line16.Width = 7 * 1440
End Select
End Sub
Found The Problem I had the default value for TextD set to 0, I removed
that and all works fine.
Thanks
DS
 
Back
Top