J
Jos Vens
Hi,
I have a problem with a Userform which I use for a double purpose. Because
everything is complex, I split up the procedures in different modules. Here
comes the problem: the pointer to the userform gets lost when I execute a
procedure in a different module than the first module that is chosen by the
form. Can I solve this, or must I put everything in the first called
module?
An example makes everything clear (this is a simplification, in fact, it
runs more than 1000 lines of code, that's why it is put in different code
modules!)
Thanks for your help!
Jos Vens
Public gnProgram as Integer
'Module of the userform
'Button1
Private Sub bButton1_Click()
LOGIN1_bButton_Click
End Sub
'Button2
Private Sub bButton2_Click()
LOGIN2_bButton_Click
End Sub
'Code Module LOGIN1
Function LOGIN1_bButton_Click() <<--- Here is FrmLogin is recognized because
it is called straight from the userform
gnProgram = 1
FrmLogin.oName.Visible = True
DCL_Login
End Function
'Code Module LOGIN2
Function LOGIN2_bButton_Click() <<--- Here is FrmLogin is recognized because
it is called straight from the userform
gnProgram = 2
FrmLogin.oName.Visible = False
DCL_Login
End Function
'Code Module DECLARATION <<--- Here is the problem: FrmLogin is no longer
recognized because it's another code module
Function DCL_Login()
FrmLogin.cbCombo1.Visible = (gnProgram = 1)
FrmLogin.cbCombo2.Visible = (gnProgram = 2)
End Function
I have a problem with a Userform which I use for a double purpose. Because
everything is complex, I split up the procedures in different modules. Here
comes the problem: the pointer to the userform gets lost when I execute a
procedure in a different module than the first module that is chosen by the
form. Can I solve this, or must I put everything in the first called
module?
An example makes everything clear (this is a simplification, in fact, it
runs more than 1000 lines of code, that's why it is put in different code
modules!)
Thanks for your help!
Jos Vens
Public gnProgram as Integer
'Module of the userform
'Button1
Private Sub bButton1_Click()
LOGIN1_bButton_Click
End Sub
'Button2
Private Sub bButton2_Click()
LOGIN2_bButton_Click
End Sub
'Code Module LOGIN1
Function LOGIN1_bButton_Click() <<--- Here is FrmLogin is recognized because
it is called straight from the userform
gnProgram = 1
FrmLogin.oName.Visible = True
DCL_Login
End Function
'Code Module LOGIN2
Function LOGIN2_bButton_Click() <<--- Here is FrmLogin is recognized because
it is called straight from the userform
gnProgram = 2
FrmLogin.oName.Visible = False
DCL_Login
End Function
'Code Module DECLARATION <<--- Here is the problem: FrmLogin is no longer
recognized because it's another code module
Function DCL_Login()
FrmLogin.cbCombo1.Visible = (gnProgram = 1)
FrmLogin.cbCombo2.Visible = (gnProgram = 2)
End Function