Wednesday, April 23, 2014

Access 2013: Protecting the Programmatic Elements of a Database

This posting presents ways to protect an Access database so that users cannot edit the underlying database. This means a user should not be able to edit the VBA code, reports and forms of an Access database. The user should be able to run the database. Additionally, the user should not be able to edit the underlying tables.

Convert Database to Execute-Only Mode


The most straight forward way to project an Access database (*.accdb file) is to save it as an executable, namely a file with an accde extension. This is achieved by selecting Save As from access and saving the *.accdb file with an *.accde extension as follows. An example of Access 2013's Save As dialog is as follows:




Once the accde file type has been select, click on the Save As button.

The standard file extension (referred to as an Access 2007 file type) is *.accdb. This extension replaced the *.mdb extension used by per-Access 2007 versions of Access. The *.accde extension is also a valid Access 2007 extension. When a file is saved as *.accde, the file is in execute only mode. An Access database in execute only mode the following behavior:

  • The VBA code is compiled and not included in the distributed database
  • Forms cannot be modified
  • Reports cannot be modified.

Even though the Access database is converted into an executable (*.accde extension), a copy of Access is still required to run the file.

Access Runtime

It is possible to distribute an Access application without requiring Access to be physically installed. From a cost stand-point this is a tremendous savings. It also means that user cannot directly access the tables and queries of the underlying database, since Access is not installed. This does not prevent them from installing Access.

Executing an Access application without requiring Microsoft Access is achieved using the Microsoft Access Runtime found at: Microsoft Access 2010 Runtime. The Access Runtime can run database with either an *.accdb or *.accde extension.

The runtime means that the application will but a user will not have access to the design related toolsbut the Access project will execute.

Runtime Behavior on a Machine on which Access is Installed


It is possible to determine how an application behaves when running under the Access Runtime even if Accss is installed. The Access application (MSAccess.exe) supports a command line option, /Runtime. specifying the /Runtime options means Microsoft Access will run an Access application as if the application were running under the Access Runtime.

For example using full Microsoft Access 2013 it would be possible to run fun.accdb as if it was running under the Access Runtime using the following command:

"C:\Program Files\Microsoft Office 15\root\office15\MSACCESS.EXE" fun.accdb /Runtime

It would also be possible to run an Access executable such as fun.accde as if it was running under the Access Runtime using the following command:

"C:\Program Files\Microsoft Office 15\root\office15\MSACCESS.EXE" fun.accde /Runtime

No comments :

Post a Comment