Even if you have secured your database, you might still want to be sure that no one can examine or change the Visual Basic procedures you created. After you have fully compiled your Visual Basic project, Access no longer needs the original text of your Visual Basic statements. You can create a special execute-only copy of your database by using one of the utilities supplied with Access. An additional advantage of an executeonly database is that it might be significantly smaller than a copy that contains all the code-particularly if you have written many Visual Basic procedures.
To create an execute-only copy of any completed database application, open the database, and close any open objects. Click the Make ACCDE button in the Database Tools group on the Database Tools tab. (Note that if you’re using an Access .adp project file, this button says Make ADE.) The Save As dialog box asks you for a location and name for your new database or project. It then makes sure the current database is fully compiled and saved, copies the database to a new file with the appropriate .accde or .ade extension, removes the Visual Basic source code, and compacts the new file.
If you open an .accde file (you can find a file called Contacts.accde on the companion CD), you’ll find that you can’t open any Visual Basic module-neither the module of any form or report module nor any module object. You also won’t be able to open a form or a report in Design view or Layout view. (This is an additional benefit of an .accde file.) Figure 25–2 shows the Modules list in the Contacts.accde database file. Notice that the Design View button is disabled on the shortcut menu, indicating that you cannot view the source code of an existing module and that the only way to run code is through the database application’s interface. The Module and Class Module buttons in the Other group on the Create tab are also disabled so that you cannot create new modules. You’ll find that the Design View option is also disabled for all forms and reports, and all the commands in the Forms and Reports groups on the Create tab are unavailable.
Figure 25–2: You can’t edit any modules in the Contacts.accde database file.