Class Modules in a library database?

E

Elwin

Form modules and report modules are not available to
referencing projects. Class modules are available by
default unless specified as Private, or if there is an
Option Private Module statement at the top of the module.
See visual basic help 'Understanding scope and visibility'
under 'Scope' for all details.

The error you're getting sounds like the one I get when
I've made a reference, but for some reason it doesn't
actually get checked off. good luck.
-----Original Message-----
Is it possible to include class modules in a library
database? I have created a library database, which
includes a group of class modules, and have created a
reference to the library through the References dialog box
for my current project. However, when I attempt to
compile the application, I get an error ("User defined
type not defined") and if I run the app I get the same
error. Have I overlooked something? Thanks in advance
for your help!
 
M

Marshall Barton

Elwin said:
Form modules and report modules are not available to
referencing projects. Class modules are available by
default unless specified as Private, or if there is an
Option Private Module statement at the top of the module.
See visual basic help 'Understanding scope and visibility'
under 'Scope' for all details.

The error you're getting sounds like the one I get when
I've made a reference, but for some reason it doesn't
actually get checked off. good luck.

database? I have created a library database, which
includes a group of class modules, and have created a
reference to the library through the References dialog box
for my current project. However, when I attempt to
compile the application, I get an error ("User defined
type not defined") and if I run the app I get the same
error. Have I overlooked something?

Class modules are not made available to code outside its own
database file.

A standard way to instantiate a class object in a library is
to use a standard module public procedure in the library.
Essentially, you'd be using late binding. This is not
especially satisfactory, but you can make it work.

There is also an undocumented way to make them available
through some trickery of modifying a saved text version of
the class module.
http://www.mvps.org/access/modules/mdl0034.htm
 
G

Guest

To Marshall: Thanks for the info. I had pretty much come to the conclusion that it couldn't be done (I stumbled on "PublicNotCreatable" in the project explorer, which was a pretty strong hint. Thanks also for the link to the www.mvps.org website. What a great resource!
 

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