Public object scope doesn't last

G

Guest

I've created a class module (Client) to set some properties I want available
throughout my database. The database opens with a form (frmMain) loading. All
activity takes place through this form -- other forms are opened as subforms,
reports are opened from a subform of frmMain. So, I though I could declare
and set a public instance of my class when frmMain opens and have it
available to all the other forms, queries, and reports when they open within
this form. Not true. It's when a subform referring to the object (frmMain's
instance of it) is loaded, I get a complie error message that the variable is
not declared. Is there a way around this problem?
Thanks for any thoughts.
 
D

Douglas J. Steele

If you mean you've declared the class object in your form's class module,
that's the problem. Put the declaration in a standard module. (You can still
put the code to instantiate it in the form's module)
 
G

Guest

That did the trick. Thanks, Doug.

Douglas J. Steele said:
If you mean you've declared the class object in your form's class module,
that's the problem. Put the declaration in a standard module. (You can still
put the code to instantiate it in the form's module)
 

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

Top