Scope of Class Module Vars

B

Bob

Hello,
I've been working around this problem for way too long.
Any help on this would be very much appreciated.

I'm very comfortable with building class modules.
What I'd like to be able to do is...
-dim o as new cl_Orders
-o.SomeVar1 = something...
-o.SomeVar2 = something...

Then go to another form and continue to fill this instance of this class.
...as soon as I go to another form, I am out of scope for this class..
I just can't seem to find what I'm missing to allow me keep an instance of
a class open through different forms.

any help would be greatly appreciated.
thanks,
bob.
 
T

Tom van Stiphout

On Tue, 25 Sep 2007 20:51:11 -0400, "Bob"

It's indeed a matter of scope. If you dim the object at the global
level, you won't have this problem.
In a standard module write:
global o as cl_Orders
Then in form1 you can New it, and continue to use it in form2.

-Tom.
 
B

Bob

Thanks Tom.
I appreciate the reply. I tried that prior to my post.
....that's where my frustration is coming in.

From a standard form, in the OnClick event,
I try something like....
Global J as new cl_Jobs.

I get an error message of"
Compile error:
Constants, fixed_length strings, arrays, user-defined types and Declare
statements not allowed as Public members of object modules.

If you can further assist,
I'd sure appreciate it.
thanks again,
bob.
 
T

Tom van Stiphout

On Tue, 25 Sep 2007 23:39:49 -0400, "Bob"

I didn't say "standard form", I said "standard module".
-Tom.
 

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