Global members

  • Thread starter Thread starter Gijs van Swaaij
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top