I have multiple forms that all run the same sub routine. In each form, I simply call the standard module that contains the sub routine. My sub routine contains a variable which gathers the form name of the open form and also the userName value of each form, like this:
-
Public userNameBC, frmName As String
-
Public Sub Form_Load()
-
Set frmCurrentForm = Screen.ActiveForm
-
frmName = frmCurrentForm.Name
-
userNameBC = Forms(frmName).userName.Value
-
End Sub
-
The problem I'm having is the variable's that I set (frmName and userNameBC) are not working in my module. For example, if I test it by putting the following code in my module, the message box is blank.
- MsgBox frmName & userNameBC
However, if I put the same message box code in my actual form, I can see the actual variables.
I can't figure out how to get get around this. Any ideas?