16.4. Secure VBA Code
There are many reasons to protect your Microsoft Visual Basic for Application (VBA) code. You may wish to prevent persons who are not experienced with the design of the code from introducing errors. You may also wish to conceal your intellectual property by preventing anyone from viewing the code. Or, you may want to ensure consistent application of business rules by preventing unauthorized changes. And, of course, there is the concern about hackers. Access provides two primary methods for protecting the code: securing a project and making an MDE file.
16.4.1. Securing Modules by Securing the Project
You can secure Visual Basic code from viewing or editing by locking the project from viewing and setting a password on your project. You set the project password while viewing the project in the Visual Basic Editor (VBE). When a project has a password and is locked for viewing, the password must be entered in the VBE before the Visual Basic code can be opened. The password is requested only once for each time that database is opened, and it is only requested if there is an attempt to access the code using the VBE.
Setting a password and locking the project from viewing also prevents changing the HAS Module property on forms and reports until the password has not been entered in the VBE. This is because Access needs to open the code before it can delete it, or add to it.
Setting a password and locking the project from viewing does not prevent users from changing ...
Get Access 2003 VBA Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.