Using a .Net class lbrary in Access 2000

R

RichGolebiowski

I have a class library (clsTestLib) that was created in VB.Net that I
would like to use in Access 2000. I created a typelib for the class
using regasm.exe. I am able to refernce (add a reference) the dll
using the generated typelib. In Access, when I run the Access
application and declare a new instance of the class as follows

Dim MyTest As clsTestLib.Class1
Set MyTest = New clsTestLib.Class1

I get an error Run-time message that says "File or assembly name
clsTestLib, or one of its dependencies, was not found".

If I do the same thing in a VB6 project I get the same error message
when I run the project in the IDE. However, if I compile the project
and run the executable file the program works fine, I do not get the
error message and I am able to access the class just fine.

What do I need to do to be able to acess my class library in Microsoft
Access 2000?
 
S

Simon Rear

Hi,

I had this problem myself and have just figured it out...

If your class isn't registered in the GAC your Microsoft Access 2000 program
directory should contain all output, ie .dlls etc generated from your .Net
project.

This directory is usually "C:\Program Files\Microsoft Office\Office10".

The reason for this, as I understand it anyhow, is that MSAccess.exe is the
host application, ie the applications domain and as with .Net if the
required assemblies aren't available in the GAC then the host application
directory must contain them, as private assemblies.

I've done this and my Access 2000 application successfully calls my .Net
assemblies exposed to Com.

Regards,

Simon Rear
 

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