I have created objects in class modules in my access project. In another
database I want to create the object so I can use its properties. I made
sure the database has a reference to the project. i can search the object
browser and see the methods and objects. But when i try to create the object
I get a 429 error Activex can not create object . My class instancing is
PublicNotCreateable, could that be the problem. Any reason why I am getting
this error?
You are on the right track - the Instancing property of the class should be
PublicNotCreatable. However there is still a problem in that in VBA classes
are not externally creatable. There are two ways around this - the first way
is to edit the attributes of the class. To do this you have to Export the
class, use a text editor to change the attributes then import the modified
class module. VBA will respect the modified attributes - it just won't let
you modify them directly. Further details on this technique can be found at:
http://www.mvps.org/access/modules/mdl0034.htm
The other method which I use is to create a helper function which also goes
into the code library. This is simply a public function which returns a new
instance of the class. So if my class is clsDog, I'll have a standard module
named basDog. In basDog I'll have
Public Function NewDog() as clsDog
set NewDog= new clsDog
End Function
One nice thing about this method is that you can add parameters to the
helper function to initialize any required properties of the class. For
example:
Public Function NewDog(intColor as integer) as clsDog
dim curDog as clsDog
set curDog= new clsDog
curDog.Color=intcolor
set NewDog=curDog
set curDog=nothing
End Function

Signature
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
> I have created objects in class modules in my access project. In
> another database I want to create the object so I can use its
[quoted text clipped - 3 lines]
> create object . My class instancing is PublicNotCreateable, could
> that be the problem. Any reason why I am getting this error?