Reference Libraries??

gmatriix

Registered User.
Local time
Today, 02:21
Joined
Mar 19, 2007
Messages
365
Hello All,

I am having trouble with my Reference Libraries not being the same or missing when I am using my access db from a different machines. The code works fine one one machine but not on another.

Is there a way to keep my libraries the same and work on any machine I put it on?

Thanks,
 
No. This is the biggest issue with distributing Access applications. There are several solutions, all of them unsatisfactory on some level.

1. Use late binding rather than early binding. This requires code changes. They may be minor or major depending on how much code you have that references Word, Excel, etc. Early binding defines objects specificly at compile time and so it is faster since the objects are resolved when you define them rather than every time you use them. It also gives you intellisence which is very helpful when you are coding and allows you to use enumerated constants from the reference library. Late binding just defines generic objects and it isn't until your code runs and loads the object that Access knows what type of object it is. That means you don't get intellisense since when you are coding, Access doesn't know what type of object you are working with and a bigger problem is that you can't use enumerated constants. That means that you have to use raw numbers rather than "wdDoNotSaveChanges" in the statement - WordDoc.Application.Documents(WordDoc.Name).Close (wdDoNotSaveChanges)
2. Keep multiple versions of the libraries loaded on your computer. This works with Word and Excel. You can have Office 2003 installed as well as Office 2010. Access won't promote the reference to a newer version as long as the specificed version is loaded. It doesn't work with Outlook though since you can have only a single version of Outlook installed. So with Outlook, you would need to use O2003 if your code had to work for that version also.
3. Do your development on a PC with the current versions but before distributing, copy the app to a PC with the older libraries and compile the app and fix the references.
4. Use Virtual PC to keep a separate development environment on your own PC.
 
I would like to add the issue of 64 bit vs 32 bit. I'm currently experiencing this with Autocad. The reference libraries are the same, however the reference added at work has to be removed and put back at home for the code to work, and vice versa.
 
I get around the lack of Intellisense for Late Binding by using what could be called (for want of a better name) "Mixed Binding" during development. The reference is included and I Dim as the specific object type as in Early Binding.

But I use the Late Binding "CreateObject" command to instantiate the object.

When completed, the reference is removed and the Dim changed to "As Object". It is easy to do a find and replace on the whole project and the CreateObject lines don't need to be touched.
 
This is great! Thanks for the advise,

Is there a way to have the code to refer to a default (complete set) library that will work on most all machines.

For instance, some where on the network there is a complete set library that all my machines refer to for libraries to ensure that they are all the same.

Idk......just asking

Thanks
 
Hello All,

If make my access db a excutable program and install it on each machine would that take care of my reference library problem?

Thanks
 
No. The references used by your application are held in your machine and do not get transferred with your program.

You can make a reference to your database but this will only make the modules you have written it available.

In the same way the modules for the references you see in the list in VBA are held in dll and exe files in Windows. Different systems have references to different version of those files. It isn't something to mess with.

As we said above your only real option to broaden compatibility is to use Late Binding. This is a generic call to the system to provide the registered version of a library rather than the specific library version called in Early Binding.
 

Users who are viewing this thread

Back
Top Bottom