Jump: Search for: 

Free Resources from FMS

 

Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.

Darren D.

 

 

 

 

Decompile Your Microsoft Access Database to Improve Performance, Fix Corruption, and Avoid Strange Errors

Provided by:
Luke Chung, FMS President and
Dan Haught, FMS Executive Vice President

VBA Code Corruption and Performance Drag

Periodically, Microsoft Access databases with VBA module code perform oddly. Code that previously worked suddenly fail or behaves incorrectly.

It's all very confusing, especially when Compact and Repair does not help.

The initial assumption is that the database is corrupt, which is partially true. People then resort to creating a new database and importing their objects into it which is time consuming and a pain. It solves the problem, but there's a better alternative to check first.

The Access /decompile command

Fortunately, Microsoft Access offers a way to fix the VBA compiled state with the /decompile command line option. The Compact and Repair feature only applies to the tables and does not impact VBA code. The decompile command does.

When Access is started with this and you open your database, it discards all the old VBA compilations, and leaves just your VBA source code. You'll need to compile again to get the compiled state. After compacting, your database may be significantly smaller.

To decompile your database, follow these steps

  1. From the Windows, Start, Run command line, type: msaccess.exe /decompile
    where msaccess.exe includes the complete path. For example:

    C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE /decompile

  2. When Access opens, open the database you want to decompile (with trusted authority for Access 2003 or later)
  3. Open up any module. Compile it via Debug, Compile.., then File, Save.
  4. Go back to the database and Compact it
    1. For Access 2007, Office Button, Manage, Compact and Repair Database.
    2. For Access 2003 or earlier: Tools, Database Utilities, Compact and Repair Database

The database size should be reduced and the strange errors related to the VBA code should be gone.

The example above is for Microsoft Access 2007, but it also applies to Microsoft Access 2003, 2002, 2000, 97 and earlier.

Create a Shortcut

To simplify doing this in the future (and you'll likely need this again), create a shortcut on your Windows desktop pointing to where your copy of Access is located:

C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE /decompile

Then, whenever your database is acting oddly, you can easily launch the decompile version of Access to open your database and decompile it. In a few minutes, you're back up and running with a smaller database.

Good luck!

See Also:

Return to the tips page

 

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © 2010 FMS, Inc., Vienna, Virginia
Celebrating 24 Years of Software Excellence