Dim Not Working

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

DS

This statement isn't passing a value..

Event 1
This is to set the Number.....

Private Sub Image21_Click()
Dim BT As Integer
BT = 1
End Sub


Event 2
This is to set the text in text11

Private Sub Image18_Click()
Dim BT As Integer
Select Case BT
Case 1
Me.Text11 = "Transfer Bar Check"
Case 2
Me.Text11 = "Transfer Bar Tab"
Case 3
Me.Text11 = "Quik Screen"
End Select
End Sub

After you click the first event, then the second, nothing happens,
Text11 doesn't fill.
Any Suggestions Appreciated.
Thanks
DS
 
You need to define BT as a Public Variable at the top of your code page outside
of any sub or function. Then do not define it elsewhere, just use it.

This statement isn't passing a value..

Event 1
This is to set the Number.....

Private Sub Image21_Click()
Dim BT As Integer
BT = 1
End Sub


Event 2
This is to set the text in text11

Private Sub Image18_Click()
Dim BT As Integer
Select Case BT
Case 1
Me.Text11 = "Transfer Bar Check"
Case 2
Me.Text11 = "Transfer Bar Tab"
Case 3
Me.Text11 = "Quik Screen"
End Select
End Sub

After you click the first event, then the second, nothing happens,
Text11 doesn't fill.
Any Suggestions Appreciated.
Thanks
DS

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
RuralGuy said:
You need to define BT as a Public Variable at the top of your code page outside
of any sub or function. Then do not define it elsewhere, just use it.




_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Great, That did it! Thanks
DS
 
Move
Dim BT As Integer
outside your procedure declarations.
(remove it from inside each declaration)

The way you have it now, you have declared a separate variable for each
procedure (even though they have the same name). They can't see each other,
because each is only valid within its own procedure.
 
Back
Top