Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a class module in another .mde library
Message
General information
Forum:
Microsoft Office
Category:
Access
Title:
Using a class module in another .mde library
Miscellaneous
Thread ID:
00682313
Message ID:
00682313
Views:
45
I moved some code into another database, built an .mde, and set a reference in Tools - References. Some of this code is in a class module rather than a regular module. I originally did it in Access 97 before moving it all to Access 2002. I would use the class module with:

Dim oMyClass As New MyClassModule
Dim vSomething As Variant
vSomething = oMyClass.SomeMethod([Somefield])

...and so on. It worked fine until a server was moved, changing the UNC path and breaking my references. I restored the references, generally creating new databases and importing the modules into them because I suspected corruption. It still wouldn't recognize this class, saying something like "invalid use of 'new' keyword".

There is a help topic in Access 2002 called "Troubleshoot undefined functions and references to projects or libraries" which says this: "You can't call a class module from a query, form, report or macro. Store a Visual Basic procedure in a standard module if you need to call it from a query, form, report, or macro." Funny, I was doing just that until a few days ago. I don't see that topic in Access 97 help.

I dimly remember that I did something special when creating this class module, in order to make it visible to the .mdb from the .mde library. But I can't remember what. I might have been acting on the advice of someone on this forum (or its predecessor) years ago, but I can't remember whom.

Since this library was actually used by only one database, I just imported the code and tossed the library. But I would still like to understand what I did before, and why it doesn't work now.
Next
Reply
Map
View

Click here to load this message in the networking platform