Access Database Right-Click Context Menu Creator

Wouldn't it be great to right-click an Access file to compact or decompile it? With Daniel Pineault's awesome tool, you can!

Access Database Right-Click Context Menu Creator

A common Microsoft Access troubleshooting technique is to use the undocumented /decompile command-line switch.

This will remove the compiled byte code from an Access application, forcing Access to recreate the byte code from the original VBA source code.  This approach fixes a specific type of corruption where the compiled byte code and the original VBA source code get out of sync.  From experience, those types of errors (though rare) seem to get introduced when using the Edit and Continue feature of VBA, especially when editing code-behind on forms and reports.

The problem with this technique is that it traditionally requires you to actually open a cmd window, type out the full path to msaccess.exe, then type out the full path to your .accdb file, and finally, include the /decompile switch.

A Simpler Way

Access MVP Daniel Pineault wrote a tool in Access to add the decompile switch (and other common Access commands) to the Explorer context (a.k.a., right-click) menu.

Here's the end result:

The above menu appears when right-clicking an .accdb file after running Daniel's tool.

You can download the tool from Daniel's site: Windows Explorer MS Access Database Right-Click Context Menu.

Pulling Back the Curtain

So, what does the tool actually do?

It's an .accdb, so you can look behind the scenes yourself if you would like (just hold down the Shift key when opening the file).  In fact, Daniel explicitly allows/encourages this in the comments section:

Since the database is unlocked, feel free to develop [additional] features and I’ll be more than happy to update the sample and give credit where credit is due!

But, to save you that trouble, I'll provide a brief overview:

  1. For each selected extension (*.accdb, *.accde, etc.), look up the application class name in HKCR\.accd*
  2. Add an entry for each app class name to HKCU\SOFTWARE\Classes\
  3. Create a shell\CARDA Database Tools\shell entry under the app class name
  4. For each selected command (/decompile, /compact, etc.), create a Decompile\command entry
  5. In the command entry, set a (Default) value of msaccess.exe %1% /decompile

Here are some associated screenshots:

The application class name associated with the .accda file extension on my machine is "Access.ACCDAExtension.16". The class name is version-dependent, so may be different on your device.
All of the entries in the red box above were created by Daniel's tool.

Removing the Items from the Context Menu

In the comments, someone asked how to remove items from the context menu.

Daniel's tool does not automate the process, but as he states in his response, it's very straightforward.  You just have to know which registry entries to delete. 😉

Spoiler alert: As of July 25, 2022, that feature has not yet been added...

To save you the hassle of figuring this out for yourself, I did a bit of legwork.  

To completely remove the context menu items, you just need to delete the registry entries highlighted in the red box below.  They are all found under the HKCU\SOFTWARE\Classes\ registry key.  Once again, your registry items may be slightly different than the ones shown below due to differences in Access versions.

I was initially nervous about deleting the above registry keys, so I checked on a different computer that had Access installed where I had not run Daniel's tool.  Those keys did not exist at all, so I felt comfortable deleting them on my current computer.

A look at the registry on a different computer with Access installed but where I never ran Daniel's tool. The Access.* entries in the HKCU\SOFTWARE\Classes\ key are obviously not required, as this device has worked properly for years.

Tip o' the hat to Colin Riddington for highlighting Daniel's tool in one of his recent articles, Access Command Line Switches.

External references

Windows Explorer MS Access Database Right-Click Context Menu
MS Access utility demo database which creates a Windows Explorer context menu for MS Access files to directly compact, decompile, exclusive and/or runtime.
Access Command Line Switches
This article lists the command-line switch options available for Microsoft Access.

All original code samples by Mike Wolfe are licensed under CC BY 4.0