Hack #77. Protect Programming Code from Curious Users

Your code is valuable. Add password protection to your modules.

I think you'll agree that developed code is valuable, in terms of the time and expense it took to create it as well as what would be involved to recreate it. So, like any valuable asset, a little protection goes a long way. Of course, I would be remiss if I didn't mention that the first thing you should do is have a backup system in place. But even if you do have a back-up system, if the code in a production system gets trampled somehow, it still costs the company to take down the system to fix the code.

Luckily, there is an easy way to protect your code. This hack prevents all but those who know the password from seeing your code. To add this protection, you must access the Tools → Properties menu in the VB editor, as shown in Figure 8-4. In this example, the menu item is Customers Properties because my code project is named Customers. Your menu item will reflect the name of your code project.

Tip

Initially, the name of the code project is set to the name of the database. You can change this in the General tab on the Project Properties dialog box (Tools → Properties).

Accessing the project properties

Figure 8-4. Accessing the project properties

On the Protection tab in the Project Properties dialog box, select the option to protect the project and establish a password. Enter a password, and click ...

Get Access Hacks 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.