Using a VB6 Class File with Access

M_S_Jones

Registered User.
Local time
Today, 04:23
Joined
Jan 4, 2008
Messages
119
Hello,

I'm trying to use some code in Access that was written for VB6. The code is in two parts, a class file and some code that creates a new object of the class at form level. When I've used it in VB6 I simply add a the class file to my project (control+D, and navigate to the file,) and then add the other code to a button on the form and it works fine on click. How can I do this in Access? I have tried pasting the contents of the class file (which is extremely long,) to a module, but when I run the button's code I get an error stating that the user-defined type is not defined, suggesting that it hasn't been able to read the class file's code.

Thanks for any help you can offer,

Matthew
 
Have you named this new class module you've created identically to that which was implemented in VB6?
As for importing it, from the Access VBE you can just select File > Import File
and navigate to your class module.

Now if you've got code in the class which requires certain VB6 objects (e.g. Printer) then that's different. But the class objects and instantiating should be just hunky dorey.

Cheers
 

Users who are viewing this thread

Back
Top Bottom