Link to home
Start Free TrialLog in
Avatar of Clive Beaton
Clive BeatonFlag for Australia

asked on

Problem with Office Libraries

I have a database application developed in access 10.  The application has a problem where Stop and breakpoints in the code don't work.  Following previous EE advice from having this problem before, I created a new database and imported everything except the linked tables.  The new database would not compile.  

The original database referenced Microsoft Office 14 Object Library.  The new database can't reference this library.  It only has Office 15 Object Library.  The new database does not compile with the Office 15 library.  (It errors on application.properties.)

Can anyone tell me:

1.  Why the Office 14 Object Library is not available in the new database?

2.  The file name and location of the Office 14 library so that I can browse to it and reference it.  (The little reference dialog box is too small to show the entire path.)

Thanks in advance.
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

With this plugin you will see the "light"
@ John - I'm assuming your link relates to question #2?

@ CRB1609 - When you say Stop and BreakPoints don't work, what exactly do you mean?  If you decompile the project and rebuild they may start working again.

As for the references... well would you be able to do this with late binding instead?
@DrTribos you are correct...i wrote my answer in a bit of a hurry....
@ JT - No worries, I had not heard of that plug-in before (I use MZ-Tools) and was wondering if it had a decompiler... I concluded it did not but thought I'd ask all the same.
Avatar of Clive Beaton

ASKER

Thank you both for your responses.

@ DrTribos - In answer to question 2.  I have a Msgbox at the start of a function, followed by a Stop, and I set a breakpoint on the next line of code.  When I run the code, I get the msgbox but the code does not stop on the Stop or the breakpoint.

As for the references, late binding is well beyond my skill level.

@ John - Are you still recommending the plugin?  (I also use MZ-Tools)
@CRB - no mate, you can do it!  I once thought late binding was black magic (actually I still do think that) but it is easy enough to follow the pattern...

Drawback is that you can not use intellisense
Advantage is that you don't have to worry (as much) about versions

Basic Pattern is:
Declare an object (e.g. instead of the actual thing)
Instantise the object as the actual thing

BTW from what you are saying about the breakpoints a decompile will help, I've not seen your specific issue - I tend to see it in reverse, i.e. my code breaks for absolutely no reason.

Re. seeing the light.  I think John would still recommend as the plugin allows you to see complete paths for the Reference libs...
Office 14 = Office 2010, so it appears you're developing in 2013 (which is Office 15). You cannot change that reference, even if you could find the correct libraries, and you should not use late binding to try and get around that.

Instead, determine why the application is faulting, and go from there. Often when you have issues like you describe it's because some other reference is bad, and the fact that you cannot compile would support that.

Open the References dialog let us know the items that are listed there, and we can help.

Next - can you let us know the line where your Compile options stops?
@Scott,  I should have been clearer - I was suggesting late binding to overcome this aspect of the OP:
Can anyone tell me:

1.  Why the Office 14 Object Library is not available in the new database?

But, I think your comment about not using late binding relates to this aspect?
The new database does not compile with the Office 15 library.  (It errors on application.properties.)

I totally agree that the compile error should be addressed (and an example provided), but  admit that it's all dark magic to me. I thought it would be generally safe to assume that 15 would be backward compatible so code that works in 14 would always work in 15; apparently not the case for the OP?!

I may have misunderstood your comment (specifically the bit in bold):
Office 14 = Office 2010, so it appears you're developing in 2013 (which is Office 15). You cannot change that reference, even if you could find the correct libraries, and you should not use late binding to try and get around that.

[Edit1: just dawned on me that this is a core lib - guessing that is the main reason to avoid late binding?]

Personally not wanting to give bad advice, I'd like to clear thing up a bit.  So leaving the compile error aside, can you confirm if you would avoid late binding in this situation; and if so why, and would you ever recommend or use late binding?  

I use late binding to open Excel from Word - as far as I can tell this is recommended by a lot of Word MPVs and seems to work well.  

[Edit2: I'm guessing that if this was created in 2010 then run in 2013 it would still crash in 2013?  If that is the case could the issue be related to 32 -> 64 bit (and not a difference in the lib itself)?]
Experts,

Thank you all for your continued assistance with my problem.

@DrTribos - I have decompiled and recompiled a number of times.  (BTW my code also breaks for absolutely no reason.)  I installed the plugin and it was very useful, especially with the references window.

@Scott
1. definitley not developed in 2013.  I don't even have it installed.

2. The code is attached:
I get both msgboxes but execution does not stop.

3.   Attached is the references Window for a brand new database created in access 2010, showing a rference to Office 15 .
The-Code.JPG
Database4.JPG
just dawned on me that this is a core lib - guessing that is the main reason to avoid late binding?]
Exactly. You should never use Late Binding for that reference, since it "points" to the environment in which the code is running, and trying to override that would cause a world of troubles.

I would most definitely recommend using Late Binding for other libraries, like Word, Excel, etc. This allows your code to work against the currently installed version of that application on the target machine, and as long as you don't use any features specific to a version you stand a much, much better chance of success.

Just don't use Late Binding on those core references, like "Visual Basic for Applications", "OLE Automation", etc.

CRB1609:

The reference you're showing is most definitely the 2013 library, although you're also showing that you're running this in 2010 (the "14" reference). I assume that is the cause of your compile error, and the errors you get when running the application.

If Access is creating those references when you create a NEW database in 2010, then somethings wrong with your installation of Office or Windows.

When I create a new db in 2010, I get refs to the "14" libraries.

When I create a new db in 2013, I get refs to the "15" libraries.

Is it possible the 2013 Runtime is installed somewhere? Your machine must be picking that up from somewhere. See if you can find the file identified by that reference, and let us know where it's located.

As a possible fix, first make sure that Office and Windows are fully up to date. If that doesn't work, I'd try a repair install of Office first, but I'm guessing that you'll have to do a complete uninstall/repair of Office.
SOLUTION
Avatar of DrTribos
DrTribos
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Scott -
1.  Using John's plugin, I found that Microsoft Office 14 refers to MSO.DLL.  
2.  I have OFFICE 15 folders in both Program Files and Program Files (x86).  
3.  I didn't knowingly do anything to put them there.
4.  Microsoft Office 15 is not installed.
5.  I can create a database and manually change the reference to the OFFICE 14 dll, but the following line gives a complie error:      db.Properties!AppTitle = "CA Development"

I am tempred to delete all folders/subfolders of OFFICE 15, but I thought I would run it by you, first.

Thanks.

Clive
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much.