Reference problem in VBA code between 2003 and 2007

User avatar
ErikJan
BronzeLounger
Posts: 1256
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Reference problem in VBA code between 2003 and 2007

Post by ErikJan »

Have a system where Office 2007 is installed. We opened an Access 2003 DB and worked with it. There were some problems so we installed Access 2003 on the system as well... All works but in a DB where we have some small code there is an error ("Object or class does not support the set of events").
I think I know what is going on... When I look at the code references, I see "Microsoft Access 12.0 Object Library", referring to MSACC.OLB in the Office12 folder. That is the 2007 link. I should replace that with the 2003 link (in Office11). I can't edit or un-check the current reference however as it is in use...
The code is small. Would the best way be to delete the code... save the DB and re-create it? Will that link again to the right MSACC file? Of is there a better and easier way?

(Or maybe I'm wrong ;-))

User avatar
HansV
Administrator
Posts: 78558
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Reference problem in VBA code between 2003 and 2007

Post by HansV »

Are you sure it's the Microsoft Access 12.0 Object Library? Access should resolve the version number automatically even if you open the database in an earlier version of Access. (This is not true for non-standard references, only for the Access reference itself).

I don't know of any way to change the reference to Access itself - just like the reference to Visual Basic for Applications, it is always present, even if the database doesn't contain any code, so it is always in use.
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1256
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Reference problem in VBA code between 2003 and 2007

Post by ErikJan »

But Office 2007 (incl. Access 2007) is still installed on the system (and I'd like to keep it that way). Wouldn't that mess things up then?

User avatar
HansV
Administrator
Posts: 78558
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Reference problem in VBA code between 2003 and 2007

Post by HansV »

I don't think that it should matter, but perhaps you can tell us what problems made you decide to install Access 2003...
Best wishes,
Hans

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Reference problem in VBA code between 2003 and 2007

Post by Wendell »

Adding my :2cents: - if you installed 2003 after 2007, you are likely to see all sorts of misbehavior in both 2003 and 2007. The method for installing two versions of Access is to always install the older version first, and that usually works OK, aside from some annoying behavior when you switch from one version to the other. In addition, we run numerous databases that were developed in 2000/2002/2003 on 2007 through 2013 and see very few issues with each upgrade, so I think Hans' question about what kind of problems you saw in 2007 is very germane. If you are seeing issues in 2007 - assuming it is at the latest SP - odds are there is some code that is not well crafted, or the database has some hidden corruption.
Wendell
You can't see the view if you don't climb the mountain!

User avatar
ErikJan
BronzeLounger
Posts: 1256
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Reference problem in VBA code between 2003 and 2007

Post by ErikJan »

Thanks. I'm working on a solution (uninstall Access 2007). Problem was that we installed Office 2007 first, however then the jump to the new GUI and all other 'enhancements' was 'too much' for the user (he's old, >80!) I was assisting, so I decided to install Access 2003 on top. Then I got the reference issues in files that we had opened in 2007 and tried to open again in 2003.
Again, Hans helped me already in the right direction, the delay is caused by me not being at the other system regularly. I will update all of you here once I know more.

(O, and to make the picture complete... I started to install Office 2007 as I suggested an OS-update from XP >> Win7. As that was a clean install, I suggested to also upgrade to Office 2007 -as I still have a legal copy of that one-)

User avatar
ErikJan
BronzeLounger
Posts: 1256
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Reference problem in VBA code between 2003 and 2007

Post by ErikJan »

I uninstalled Access 2007 yesterday (but left e.g. Outlook, Excel & Word 2007 on the system). After a reboot, I started Access 2003. It needed half a minute of re-configuration, then it started and now everything works as it should be again (incl. the other 2007 components)! :clapping:

Thanks for all the help and suggestions.