Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Accessing Objects in another database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dbarasch - 08 Mar 2005 20:59 GMT
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?
Sandra Daigle - 09 Mar 2005 15:50 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.