General information
Title:
Using a class module in another .mde library
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only