Hi guys, I'm having a problem with public variables. I assumed variables defined as public can be accessed from any form and looks like I can not.
The variable is basically supposed to store IDUser, which is the user logged in and that is operating through the forms, and I need to store it when logging in is successfull and to set the variable as null when logging out.
Basically when jumping to the next form pbUser is detected as Null, how can set such a variable up to work like this?
I know it's a very basic thing but I have never worked with "public" variables.
Thanks for your time.
The variable is basically supposed to store IDUser, which is the user logged in and that is operating through the forms, and I need to store it when logging in is successfull and to set the variable as null when logging out.
Code:
Public pbUser as String
Private Sub Login()
If Not isNull(Me.cmbUser) Then
pbUser = me.cmbUser.Column(0)
DoCmd.OpenForm "frmMain"
DoCmd.Close acForm, "frmLogin"
Else
Msgbox "¡Select the user!"
Exit Sub
Endif
End Sub
Basically when jumping to the next form pbUser is detected as Null, how can set such a variable up to work like this?
I know it's a very basic thing but I have never worked with "public" variables.
Thanks for your time.