JedNebula
asked on
Deploying .NET assembly for use with VB6 and Microsoft Access
I have a .Net assembly which I need to be able to use from three different program types;
-Microsoft Access (ver. 2000 I'm afraid)
-VB6
and VB.Net
Obviously I'm not too worried about that last one (VB.net) - as that's easy.
I've read a lot about adding assemblies to the GAC, but have never actually done it. I do have one assembly which I use in a VB6 app, but I don't use the GAC for this, I just deploy the TLB file and then call Regasm with the location of the TLB file specified as an argument.
In the playing around with all of this, trying to get it to work, I found it all quite messy. I was wondering if anyone has experience with getting MS Access to use a TLB file and if so, what the easiest way of deploying it all is. In my limited experience, I found that I had to put the TLB file in the same directory as MSACCESS.exe (i.e. C:\Program Files\Microsoft Office\Office) not the location of the MDB/MDE! Is this really the way it has to be?
If someone could outline the steps required as simply as possible, I would be most grateful.
-Microsoft Access (ver. 2000 I'm afraid)
-VB6
and VB.Net
Obviously I'm not too worried about that last one (VB.net) - as that's easy.
I've read a lot about adding assemblies to the GAC, but have never actually done it. I do have one assembly which I use in a VB6 app, but I don't use the GAC for this, I just deploy the TLB file and then call Regasm with the location of the TLB file specified as an argument.
In the playing around with all of this, trying to get it to work, I found it all quite messy. I was wondering if anyone has experience with getting MS Access to use a TLB file and if so, what the easiest way of deploying it all is. In my limited experience, I found that I had to put the TLB file in the same directory as MSACCESS.exe (i.e. C:\Program Files\Microsoft Office\Office) not the location of the MDB/MDE! Is this really the way it has to be?
If someone could outline the steps required as simply as possible, I would be most grateful.
ASKER
Hi Gary,
Thanks for the reply.
The client machines will only be using a run-time version of Access so the references all need to be intact for the link to work. Sorry if I'm not explaining myself very well.
Thanks for the reply.
The client machines will only be using a run-time version of Access so the references all need to be intact for the link to work. Sorry if I'm not explaining myself very well.
You need setup the reference before you build your mde & include the TLB in your installation package
ASKER
OK that's fine, but where do I put the TLB file? I presume I need to deploy the dll file as well? - agian, where to?
hi
the way i used a few times in the past, is set the object "register for com interop" in the project properties in visual studio, then build the dll
now in vb or vba, go to references and brows to find the dll (you dont have to use a tlb, though it is friendlier)
now you can instaciate and use all objects from that dll just as any other objects you use in vb/vba
not too hard, is it?
the way i used a few times in the past, is set the object "register for com interop" in the project properties in visual studio, then build the dll
now in vb or vba, go to references and brows to find the dll (you dont have to use a tlb, though it is friendlier)
now you can instaciate and use all objects from that dll just as any other objects you use in vb/vba
not too hard, is it?
ASKER
Hi ErezMor,
I am already registering for com interop in Visual Studio, but I get the error "Can't add a reference to the specified file" when trying to add the reference in access.
Regards,
Rawden.
I am already registering for com interop in Visual Studio, but I get the error "Can't add a reference to the specified file" when trying to add the reference in access.
Regards,
Rawden.
ASKER
Sorry ErezMor,
I thought I would just clarify my last post. The error I get about not being able to set a reference only happens when trying to set it to the DLL, if I set it to the TLB file then it's fine. That's not really the problem though, the problem is deploying it to the client machines so that it'll work there too.
I thought I would just clarify my last post. The error I get about not being able to set a reference only happens when trying to set it to the DLL, if I set it to the TLB file then it's fine. That's not really the problem though, the problem is deploying it to the client machines so that it'll work there too.
You just need to install it with your application ,not Access
ASKER
when you say install it with your application, what do you mean? Do I just need to copy the TLB file, the DLL file and the MDB into the same directory because in my experience, that hasn't worked.
Are you not preparing a setup?
ASKER
not currently no. I'm just trying to work out which method will work the best. either using the gac or not. Once I can get it to work manually, i'll then do a setup package sure.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay thanks Gary. I got it working with the Visual Studio Setup package method, but do you have the steps for the manual process because I'm not using that to create my setup. Can it even be done?
The TLB just needs to be installed on the machine & set a reference to it in Access
Good Luck!
Gary