Using the decompile option
A little known start-up, command-line option is called /decompile. You may have seen other Access command-line options, such as /nostartup, /cmd, and /compact. The /decompile option starts Access in a special way and, when a database is opened, saves all VBA modules as text. This works with module objects and all the code behind forms and reports.
To decompile your application, follow these steps:
- Go to the Windows Start menu Run command.
The Run window appears. - In the Open text box, type msaccess /decompile and click Open.
- Open your application as you normally would, holding down the Shift key while you click on OK.
This prevents start-up forms or autoexec macro processes from running. You don't want the database to run code that forces even a single module to be compiled.
Access appears to start as usual, but the database may take several minutes to open if it contains a lot of data or VBA code. At this point, the real question is whether the database gets sufficiently smaller, runs faster, and stays compiled after it's compiled and compacted. - After the database window is displayed, close Access.
Don't just close the database window - actually exit Microsoft Access. - Restart Access.
- Open your database, open any module, and choose Debug → Compile Project Name.
- After the database compiles, close the module, return to the Access window, and compact and repair the database.
You should find that Access runs these procedures much faster than usual.
If you're ready to release your application for a real test by the users, follow these steps to insure a clean-running system:
- Reboot your computer to clean up memory.
- Create a new Access database and import all the objects.
- Restart Access by using the /decompile option while holding down the Shift key. Close Access after the database window is displayed.
- Restart Access normally while holding down the Shift key.
- Compile the database.
- Compact and repair the database.
By releasing a clean, fully compiled and compacted system, your application runs faster and has fewer technical or maintenance problems.
Caution: Make sure that you immediately exit Access after it finishes decompiling and then start Access again before running Compile Project Name or Compact and Repair Database.
In this tutorial:
- Optimizing Access Applications
- Understanding Module Load on Demand
- Using the .accdb Database File Format
- Distributing .accde Files
- Understanding the Compiled State
- Application's code into a compiled state
- Distributing applications in a compiled or uncompiled state
- Creating a library reference for distributed applications
- Improving Absolute Speed
- Getting the most from your tables
- Getting the most from your queries
- Getting the most from your forms and reports
- Using bitmaps on forms and reports
- Getting the most from your modules
- Using control variables
- Eliminating dead code and unused variables
- Improving Perceived Speed
- Loading and keeping forms hidden
- Speeding up the progress meter display
- Working with Large Access Databases
- Recognizing that compiling and compacting
- Using the decompile option
- Detecting an uncompiled database and automatically recompiling