Preventing Changes to a Database

If you have added VBA procedures to a database, you certainly don’t want users who aren’t qualified or authorized to make changes to your code. You can prevent unauthorized access in two ways: you can protect your VBA code with a password, or you can save the database as a Microsoft Database Executable (MDE) file. If you set a password for the code, it remains available for editing by anyone who knows the password. If you save the database as an MDE file, people using the file can run your code, but they can’t view or edit it.

In this exercise, you will secure the VBA code in a database by assigning a password to it.

USE the GardenCo database in the practice file folder for this topic. This practice file is located in the My DocumentsMicrosoft PressAccess 2003 SBSSecureVBA folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Access 2003 Step by Step.

OPEN the GardenCo database and acknowledge the safety warning, if necessary.

  1. Press to open the Visual Basic Editor.

  2. On the Visual Basic Editor’s Tools menu, click db1 Properties.

    Preventing Changes to a Database
  3. In the Project Properties dialog box, click the Protection tab.

  4. Select the Lock project for viewing check box.

  5. In the Password box, type 2003!VBA, and press .

  6. In the Confirm Password box, type the password again, and then click OK.

    The password is set, but it won’t be active until the next time you open the database.

  7. Close the Visual Basic Editor, and then close the database.

  8. Open the database again, acknowledge the safety warning, if necessary, and then press to open the Visual Basic Editor.

    The editor opens, but all that is displayed in the Project Explorer is the name of the project. The Code window is closed.

  9. Click the plus sign to the left of the GardenCo project name to expand the project.

    Access displays a Password dialog box.

    Preventing Changes to a Database
  10. Type 2003!VBA, and click OK.

    The project expands to display its components.

    Tip

    You have to enter the password only once per database session. In other words, you won’t have to enter it again unless you close and reopen the database.

  11. To remove the password, on the Tools menu, click db1 Properties.

  12. Click the Protection tab, clear the Lock project for viewing check box, delete the asterisks in the two password boxes, and click OK.

    Tip

    The lock and password settings operate independently. Clicking the "Lock project for viewing" check box requires the user to enter the password to view the project. If a password has been set and the "Lock project for viewing" check box is cleared, the user can view the project code but has to enter the password to open the Project Properties dialog box.

  13. Close the Visual Basic Editor.

CLOSE the GardenCo database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.241.199