Reference another Microsoft Access .mdb does not enable classes

S

stevemets

I added a reference to another MS Access database, and can use it's objects
(forms, code modules, functions, etc.) but the classes in the 2nd database do
not even show up in the object browser in the referencing .mdb, let alone
allow use of them.

How do I instantiate these classes (there are a lot of them- I'd like some
way to just instantiate them as needed, or somehow use a function to
encapsulate the process so it happens when the referencing DB opens). Any
ideas?

Thanks!
 
6

'69 Camaro

Hi, Steve.

The class's VB_Exposed attribute allows other databases to see the class,
and the VB_Creatable attribute allows other databases to instantiate objects
from the class. Depending upon which version of Access you are using, even
if you change the VB_Exposed attribute to allow you to see the class from
other databases, you may not be able to change the VB_Creatable attribute, so
won't be able to instantiate the object in another database.

Please see the following Web page for a discussion last year about the pros
and cons of several different approaches to the problem:

http://groups.google.com/group/micr...*+author:camaro&rnum=1&hl=en#fac51736f3c70e61

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
S

stevemets

I just posted a question about how to reply, and then scrolled over to find
the reply button, so please disregard that post.

Regarding the reply below, I have seen the VB_Creatable/Exposed Attributes,
and I think I was able to modify one or both, making them visible in the OB;
I used a nice utility that exports the class as text, changed the attribute,
and re-imported the class. I believe that this would be ok, and probably
could be automated to update the 200 or so classes that I would need to
change. I have seen this done in another example, but I had lost everthing
in hurricane Katrina (lived in New Orleans), and was not able to ask how it
was being done before the disaster- but I know it works (this was in and
Access '97 DB- I would like to do this same process for 200-2003 version as
well).

However, with that said, I really am searching for a function that will
instantiate required classes on load, and a similar one to release them if
they are not needed, or upon close. Right now, these are basically shared
classes, and functions in modules, that are in a separate MS Access DB. If
you know of a link for such functions, I would appreciate it. Also, is there
any advantage putting them in a library file instead of an .mdb, and would it
eliminate all of the above issues?

Thanks for any help! Steve
 

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