Lock the Database

by Adrian Price

Sometimes you need to prevent the user from accessing all the parts of an Access database. Here are some methods I've found useful.

Create a Runtime Version

This is the best way to stop anybody accessing any part of a database of the visual basic code. Simply change the file extension from .accdb to .accdr and this makes your program a 'runtime' version - it can be run but not changed.

Now perform and end to end test of the program and note that any error will cause the program to crash unless you have fantastic error handling routines!

For more on this topic, see the Access Runtime topic.

Capture F11

To prevent F11 displaying the Navigation Pane, add a key-detecting macro:

  1. In the Create ribbon, choose Macros & Code > Macro - a new macro pane opens
  2. In Macro1, double click Submacro in the Action Catalog. Click Action Catalog in the Design ribbon if it's not in view

To the right of Submacro, type {F11}

  1. Click in Add new Action and choose Beep
  2. Press Ctrl-F4 to close Macro1 and at the save prompt, type AutoKeys as the name.

Any time that F11 is pressed to display/hide the Navigation Pane, only a beep will be heard!