Ok guys I'm sorry and really embarrassed for asking this, but its so simple and I'm surprised I never ran into this before.
When using variables in a forms vba module (not sure the actual name of that, but NOT a separate module, but the one attached to a form), If I declare a variable in the forms onOpen event and set a value to it, would that variable and value be accessible in lets say that same forms onClick event of a button?
I obviously tried it before posting and apparently I cant, or am possibly just declaring it wrong:
How would I go about doing this?
When using variables in a forms vba module (not sure the actual name of that, but NOT a separate module, but the one attached to a form), If I declare a variable in the forms onOpen event and set a value to it, would that variable and value be accessible in lets say that same forms onClick event of a button?
I obviously tried it before posting and apparently I cant, or am possibly just declaring it wrong:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim myVariable As string
myVariable = "Step 1"
End Sub
Private Sub cmdnext_Click()
Select Case myVariable
Case "Step 1"
Me.lblStep1.Visible = False
Me.lblStep2.Visible = True
myVariable = "step 2"
Case "step 2"
Dim strSearchPath As String
Dim strFileName As String
...
How would I go about doing this?