Class Modules

  • Thread starter Thread starter Luke Bellamy
  • Start date Start date
L

Luke Bellamy

Hi - I have an mde file (Acc 2002) with Class Modules.
I link this mde file into my other project via references.

When I "dim" one of the external classes it says
"User Defined Type" not found. This is because the Instantiation
flag is set to Private.
The only other option is "PublicNotCreatable" which causes the
external classes to be declared (dimmed) but as soon as I set it
to a new is says that I can't set obj = new Cls. I'm guessing
because it really is Public Not Creatable :-)

I think I'm missig something here. Any comments would be
appreciated.
 
Thanks Albert.. thats makes things alot clearer.
Am I correct in saying that I would have to use the 2nd option
if I wish to dim the external object in the mde?

What I mean is that if the class is private and I make a standard
mobule funtion to create it, then compile still fails when I type in
Dim obj as MyExternalMDE.objMyObject
Probably would have to dim it as an 'Object' type.

If I update the Exposed flag then I can dim the object as well
as New it.
 
Thanks Albert.. that's makes things alot clearer.
Am I correct in saying that I would have to use the 2nd option
if I wish to dim the external object in the mde?
yes....


What I mean is that if the class is private

Those classes module by nature are public. You don't really have a choice
here, as the class object takes on the name of the module, not the
declarations inside the module. To make a class object while on the "module"
tab...you go insert->Class module.
and I make a standard
mobule funtion to create it

Well ok...but you want to make a class object here.....right..not a standard
module? You need to be creating a new class object module. Perhaps you are
trying the work around where you use a public function that returns a
instance of the object..but you don't need to do that.
, then compile still fails when I type in
Dim obj as MyExternalMDE.objMyObject

Hum...the above might have worked. However, it is easer to use the class
object name direclity in your code.

For example, I might have a custom progress bar, and thus have a class
module called clsPbar. So, in code I would create a new instance of this
class object via:

dim MyProgressBar as new clsPbar
Probably would have to dim it as an 'Object' type.

If the references are set correctly, and you use the exposed flag..then your
defs would be the same as if you simply created a class object/module in
your existing application.
If I update the Exposed flag then I can dim the object as well
as New it.

Yes..you got it!....The exposed flag will work, and even the
methods/properties of the object will show in inteli-sense.


And..for some reading and ideas as to when class objects are handy...you can
read the following of mine:

http://www.attcanada.net/~kallal.msn/Articles/WhyClass.html
 
Back
Top