Looking to take your VBA skills further?...

Discover twinBASIC — a powerful new development platform that expands on VBA and VB6 with advanced features, modern tools, and enhanced compatibility. Perfect for those ready to elevate their projects or transition from VBA, twinBASIC lets you build on what you already know and take your applications to the next level!

Try out twinBASIC Community Edition - it's free!

Errors using multiple versions of Access under Vista/Windows 7

        1 votes: *****     2,10 views      No comments
by Allen Browne, 20 April 2005    (for Access )

Flaws in Microsoft Access

Provided by Allen Browne, December 2006.  Updated April 2010.


Errors using multiple versions of Access under Vista/Windows 7

If you install multiple versions of Access under Windows Vista or later, you receive errors when you run any code in Access 2000, 2002 and 2003.

For example, if a form has code in its Current event procedure, it fails to open with this message:

The expression On Current you entered as the event property setting produced the following error:
Object or class does not support the set of events.

Earlier versions do not run at all. If you switch to Access 97, you are told:

Microsoft Access can't be started.
Microsoft Access was unable to initialize the Windows Registry
Rerun Microsoft Access or Microsoft Office Setup to reinstall Microsoft Access.

Switching to the lastest version of Access works (after the pause for reinstallation.)

References error screenshot

 

Cause

The Access and Office library references are adapted to the version of Access you open. Under Vista, programs do not have the privilege to alter the registry.

Access therefore runs with the last registered library. The code cannot compile using the library of the wrong version, so no code works.

The screenshot is from Access 2000. It correctly identifies the Office 9.0 library (since no database had been opened using the Office library), but incorrectly attempts to use the Access 12.0 library (since Access 2007 was used previously.)

To read more about what References are and which ones apply to each version of Access, see Solving Problems with Library References.

 

Workarounds

Here are some alternatives.

Option 1: Modify the Registry

This suggestion from Graham Mandeno (Access MVP) modifies the Windows Registry so that Access always runs with full permissions:

  1. Start RegEdit.
  2. Find the key:
        HKEY_CLASSES_ROOT\TypeLib\{4AFFC9A0-5F99-101B-AF4E-00AA003F0F07}\9.0
  3. Right-click it, and choose Permissions.
  4. In the Permissions dialog, select the Users group.
  5. Under Permissions for Users check the Allow box beside Full Control.

Even though the key refers to 9.0, the solution applies to all versions from Access 2000 onwards.

(As always, exercise care when editing the registry.)

Option 2: Use Run As Administrator

Create a shortcut to run each msaccess.exe as an administrator. This allows each version to register itself on start-up.

To set up this workaround:

  1. Delete any shortcuts created by installing Office. (These lack the Run As Administrator option.)
  2. Create shortcuts to msaccess.exe from each version of Office. (Right-drag them from the folder in Computer.)
  3. Right-click the shortcut, and choose Properties. Click the Advanced button. Check the Run as Administrator box.

Each time you start Access, you will need to click the Continue button in the User Account Control warning dialog.

For Access 2007, you can use a normal shortcut, i.e. Run As Administrator is not needed for this version.

February 2008 Update: after you make this change, you may need to switch to another version and switch back before Access will register the correct library.

Option 3: Remove the Safety

The simplest (and least safe) workaround is to disable UAC, and use an administrative account.

Warning: This degrades the security of Vista. Malware can install itself as in earlier versions of Windows.

Assuming you are logged in as a computer administrator, the steps are:

  1. Open Control Panel.
  2. Double-click User Accounts.
  3. Click Turn User Account Control on or off.
  4. Uncheck the box, Use User Account Control (UAC) to help protect your computer.
  5. Click Ok.

You can now switch Access versions as you could under previous versions of Windows. (This does not avoid the reinstallation delay.)

Option 4: Use separate machines

In a corporate environment, you may not be permitted to use either of the options above, so you will need a separate machine for each version of Access. These "machines" may be virtual PCs, a computer that multi-boots, or physical computers.

The Virtual PC might be the quickest way to constantly swap between versions - once you get it started. Disadvantages:

  1. It requires serious hardware (especially RAM.)
  2. It is slower to execute. (An emulator is not good for testing.)
  3. It needs an additional Windows licence.
  4. If the Virtual PC runs Vista, you need separate Virtual PC sessions for each additional version you support.

Option 5: Reinstall Office every time

You could run setup.exe from each version of Office every time you wanted to switch versions, but this is no solution. It would require administrative control, be an exercise in frustration with the UAC dialogs, and consume more time than it was worth.

Option 6: Avoid Vista

You might choose to stay with Windows XP or earlier versions.

There is no advantage to this workaround. It is no safer than Option 3 above.

 

Why multiple versions?

If you are asking this question, the entire problem does not apply to you. Chances are, no one else uses the databases you create.

If you develop databases or support clients who use different versions of Access, you must be able to run multiple versions to:

  1. Create MDEs.
  2. Decompile and compile in the target version (to avoid the weird compilation bugs.)
  3. Test, and trace problems in the same version as your client.
  4. Make any changes to databases from Access 97 or earlier.

Home Index of tips Top

Rate this article:  Your rating: PoorYour rating: Not so goodYour rating: AverageYour rating: GoodYour rating: Excellent


This is a cached tutorial, reproduced with permission.

Have your say - comment on this article.

What did you think of 'Errors using multiple versions of Access under Vista/Windows 7'?

No comments yet.

Why not be the first to comment on this article?!

Have your say...

Name
E-mail (e-mail address will be kept private)
Comments


Comments require approval before being displayed on this page (allow 24 hours).