Global members

G

Gijs van Swaaij

I'm currently having a lot of trouble with what seems to be a very
basic problem, but I couldn't find anything on these groups.

The problem is: I have a form with a subform, both with a module. In
the declarations section of the subform module, I declare a public
variable as follows:
public varName As boolean

Now when I try to access it in the main form using the syntax
MsgBox(Sub6.varName) (Sub6 is the name of the subform), it acts as
though the variable doesn't exist. I also tried to create a public
function getVarName() (Yes, I have OOP experience...); but that only
gave some runtime errors, when the thing complained about not being
able to find the function. What am I doing wrong? Any help would be
greatly appreciated!

Gijs van Swaaij
 
A

Allen Browne

If this MsgBox() is in another module, you need to full reference to the
class module of the form.

Somthing like this:
MsgBox(Form_Sub6.varName)
assuming that Sub6 is the name of the form that gets loaded into the subform
control.
 
Top