MS Access references

kenabbott
kenabbott used Ask the Experts™
on
Hi

I have an Access db which is installed on a number of PC's in an office.  It requires reasonably frequent updates but I am having a problem with the references.  For example on my PC I have to have it set to Outlook 14.0 Object Library. However on some (but not all) of the PC's where it is installed it only works with Outlook 12.0 Object Library.  I have also noticed that one of the PC's that does have Outlook 14.0 Object Library seems to have it installed in a different place.

At present the references are having to be reset manually every time there is an update but is there a more automated way of resolving this?

Man thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Depending on how complex it is the Access-Outlook interacion, you coul use late-binding for creating Outlook objects.
So when you declare the Outlook objects, you'll obly have to declare As Object and when you create the instance you can use CreateObject using the object ProgID.
This way you could remove the Outlook reference from Access.
This solution supose you don't have a very complex interaction between Access and Outlook and also the ProgId for OutlookObjects remained the same between version 12 and 14 of Outlook
Top Expert 2016
Commented:
use late binding instead of early binding in your codes..

see this links for more detailed explanation

Late Binding in Microsoft Access
http://www.granite.ab.ca/access/latebinding.htm

Using early binding and late binding in Automation
http://support.microsoft.com/kb/245115
ramromconsultant
Commented:
Run this VBA code:
application.references.AddFromFile "C:\Program Files (x86)\Microsoft Office\Office14\MSOUTL.OLB"

Of course the path will differ. You can extend the code to try each path until you find the desired one.

Is that sufficient?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
I agree with capricorn1, late binding is the solution for this.

It will require some work to identify all of the Outlook constants you have used, but that is really just a matter of removing the Outlook reference, then debug-compile.

Identify the Outlook constant names and their values, then declare them in your code.  Then debug->compile again, to find the next one.  It is an iterative process, but once it is done, you will not have any problems.

BTW, you should be developing for the lowest level of Office, to ensure that you don't use a method or property that is only available on the later versions.
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
+1 for late binding. Trying to reset references, or add them, to a running application is never a good solution.

you should be developing for the lowest level of Office,
If you do this, then you really don't have to worry about late binding, although it's still a good idea. If you code in the lowest version of Office you must support Access will upgrade the references when you move to the newer platform (it cannot downgrade them, however).
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
Scott, great info.  I didn't realize that Access would automatically upgrade the reference.  I've just always (ever since I started coding for multiple Office versions) just done the late binding.
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Late Binding is the best way to handle this, without a doubt, but I have always made it a point to build to the "lowest common denomintor", and in my early days I never used Late Binding, and had no reference issues caused by incorrect versioning. I do extensively use Late Binding now.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial