Chapter 26: Bulletproofing Access Applications
933
Protecting Visual Basic code
You control access to the VBA code in your application by creating a password for the Visual Basic
project that you want to protect. When you set a database password for a project, users are
prompted to enter the password each time they try to view the Visual Basic code in the database.
Note
A Visual Basic project refers to the set of standard and class modules (the code behind forms and reports) that
are part of your Access database.
- Open any standard module in the database.
For this example, open the basSalesFunctions module in Chapter26.accdb.
- In the Visual Basic Editor, choose Tools ➪ Chapter26 Properties.
The Project Properties dialog box appears.
- Select the Protection tab (shown in Figure 26.22).
FIGURE 26.22
Creating a project password restricts users from viewing the application’s Visual Basic
code.
- Select the Lock Project for Viewing check box.
- Enter a password in the Password text box.
Access does not display the password; instead, it shows an asterisk (*) for each letter.
- Type the password again in the Confirm Password text box and click OK.
This security measure ensures that you don’t mistype the password (because you can’t see
the characters that you type) and mistakenly prevent everyone, including you, from
accessing the database.