MS-Access / Getting Started

Distributing .accde Files

One way to ensure that your application's code is always compiled is to distribute your database as an .accde file. When you save your database as an .accde file, Access compiles all code modules (including form and report modules), removes all editable source code, and compacts the database. The new .accde file contains no source code but continues to work because it does contain a compiled copy of all your code. Not only is using an .accde file a great way to secure your source code, but it also allows you to distribute databases that are smaller (because they contain no source code) and always keep their modules in a compiled state. Because the code is always in a compiled state, less memory is used by the application, and you suffer no performance penalty for code being compiled at runtime.

In addition to not being able to view existing code because it's all compiled, the following restrictions apply:

  • You can't view, modify, or create forms, reports, or modules in Design view. You can, however, create and modify tables and queries in an .accde file.
  • You can't add, delete, or change references to object libraries or databases.
  • You can't change your database's VBA project name by using the Options dialog box.
  • You can't import or export forms, reports, or modules. Note, however, that tables, queries, and macros can be imported from or exported to non-.accde databases.

Tip If you want to create a demo of your application - and if you don't want the users to be able to see your code or form and report designs - you should create an .accde file. Because the designs of your forms, reports, and all code modules are simply not present (they're stored in a compiled version only), you don't have to worry about someone stealing or even modifying your designs and code. An .accde file is also good for distributing your work in environments where you don't want the user to change your designs.

Because of these restrictions, it may not be possible to distribute your application as an .accde file. For example, if your application creates forms at runtime, you wouldn't be able to distribute the database as an .accde file.

Caution You have no way to convert an .accde file back into a normal database file, so always save and keep a copy of the original database! When you need to make changes to the application, you must open the normal database and then create a new .accde file before distribution. If you delete your original database, you won't be able to access any of your objects in Design view.

To create an .accde file, follow these steps:

  1. Save and close all the database objects.
    If you don't close these objects, Access tries to close them for you, prompting you to save changes where applicable. When working with a shared database, all users must close the database; Access needs exclusive rights to work with the database.
    Tip Since Access can't convert an application into an .accde if it can't compile it, you may want to compile your application first.
  2. Select the Make ACCDE command on the File menuShare ribbon. The Save As dialog box appears.
  3. Specify a name, drive, and folder for the database.
    Don't try to save the .accde file with the same filename (including the filename extension) as the original database.

Caution Don't delete or overwrite your original database! You can't convert an .accde file to a normal database, and you can't edit any objects in an .accde file. If you delete or otherwise lose your original database, you'll never again be able to access any of the objects in the design environment.

Note: You can create an .accde file only if you first convert the database into the Access .accdb format. If the file is in an Access 2002-2003 format, you can create an .mde file - the Access 2002-2003 equivalent to an .accde file.

[Previous] [Contents] [Next]