In a Microsoft Access project (.adp), you can help protect all modules, and modules behind forms and reports, by using a password for Visual Basic for Applications (VBA) code, which you and other users must enter to view or edit VBA code in the Visual Basic Editor. Once you set a password, you enter this password once per session. The password is required not only for viewing and editing, but also for cutting, copying, pasting, exporting, and deleting any module. Note, however, that using these security measures to help protect your VBA code doesn't prevent you or other users from running existing VBA code.
If your Microsoft Access project contains Visual Basic for Applications (VBA) code, saving your Access project as an .ade file compiles all modules, removes all editable source code, and compacts the destination Access project file. Your VBA code will continue to run, but it cannot be viewed or edited.
Your Access project file will continue to function normally
Saving your Access project file as an .ade file prevents the following actions:
- Viewing, modifying, or creating forms, reports, or modules in Design view.
- Adding, deleting, or changing references to object libraries or databases.
- Changing code
— an .ade file contains no source code. - Importing or exporting forms, reports, or modules. However, tables, data access pages, views, stored procedures, database diagrams, and macros can be imported from or exported to non-.ade Access projects.
Considerations if you need to modify the design of forms, reports, or modules
Be sure to save a copy of your original Access project file. If you need to modify the design of forms, reports, or modules in an Access project file that you have saved as an .ade file, you must modify the original Access project, and then resave it as an .ade file.
You won't be able to open, convert, or run code in an Access 2002 or later .ade file in future versions of Access. The only way to convert an Access 2002 or later .ade file to a future version will be to open the original Access project that the .ade file was created from, convert it to the later version of Access, and then save the converted Access project file as an .ade file.
Considerations before saving your Access project file as an .ade file
Some restrictions may prevent you from saving your Access project file as an .ade file:
About references and .ade files
If you try to create an .ade file from an Access project file or an add-in that references another Access project or add-in, Access displays an error message and doesn't let you complete the operation. To save an Access project that references another Access project as an .ade file, you must save all projects in the chain of references as .ade or .mde files, starting from the first project referenced. After saving the first project as an .ade or .mde file, you must then update the reference in the next project to point to the new file before saving it as an .ade file, and so on.
For example, if Project1.adp references Project2.adp, which references Project3.mda, you would proceed as follows:
- Save Project3.mda as Project3.mde.
- Open Project 2.adp and change its reference to point to the new Project3.mde.
- Save Project2.adp as Project2.ade.
- Open Project1.adp and change its reference to point to the new Project2.ade.
- Save Project1.adp as Project1.ade.
A Microsoft Access project can't use the same user-level security features that a Microsoft Access database (.mdb) can. The data and other objects stored on your SQL Server must employ the SQL Server's security features.
To help protect access to the VBA code in an Access project, you must password-protect its VBA project or remove your VBA source code by saving your Access project file as an .ade file. To help protect access to the design of forms and reports in an Access project file, you can set startup options or save your Access project file as an .ade file. The only way to help protect access to macros in an Access project file is by setting startup options.