Microsoft Access 2010 Bible

(Rick Simeone) #1

Part IV: Professional Database Development


876


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:


  1. Go to the Windows Start menu Run command.


The Run window appears.



  1. In the Open text box, type msaccess /decompile (see Figure 24.15), and click Open.

  2. 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.


FIGURE 24.15
Starting Access with the decompile command-line option

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.



  1. After the database window is displayed, close Access.


Don’t just close the database window — actually exit Microsoft Access.



  1. Restart Access.

  2. Open your database, open any module, and choose Debug ➪ Compile Project Name.

  3. 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.

Free download pdf