Securing VBA Code with a Password
In earlier versions of Access, securing a form or report meant that the code behind it was also secure. With Access 2000 and above, that is not the case. User-level security does not secure your code. It secures only the forms and reports that refer to the code. This means that denying a user modify design rights to a form prevents him from adding, deleting, or modifying controls on the form, but does not prevent him from modifying the code behind the form.To secure the code in your application's form, report, standard, and class modules, you must first activate the VBE. Then select Tools, Properties. The Properties dialog box appears. Click to activate the Protection tab (see Figure 27.27). If you do not want unauthorized users to view the code behind your forms, reports, modules, and class modules, click to select Lock Project for Viewing. Then enter and confirm a password. After you lock the project for viewing, Access prompts you for a password once each session. Developers must supply a valid password to view or modify VBA code for the project.
Figure 27.27. The Protection tab of the Properties dialog box allows you to lock a project for viewing.
