When Access starts in runtime mode, it does not allow the user to access the Navigation Pane or to use any of the built-in Ribbons. So, the user can only run your application, not edit any of the objects. As you might expect, many keystrokes are also unavailable, such as pressing F11 to show the Navigation Pane or pressing Ctrl+Break to halt Visual Basic code execution. If you also download the Access 2007 Developer Extensions and Runtime tools, you can distribute your database with the modules to execute in runtime mode to users who do not have Access installed on their systems. For more information about the new Access 2007 Developer Extensions and Runtime tools, see http://msdn2.microsoft.com/cn-us/officc/bb229700.aspx.
However, to execute successfully in runtime mode, your application must have the following:
All features of the application must be implemented with forms and reports. The user will not have access to the Navigation Pane to execute queries or to open tables.
The application must have a startup form or an AutoExec macro that opens a startup form.
All forms and reports must have custom Ribbons because runtime mode does not provide the built-in Ribbon.
You must implement error trapping in all your macros and Visual Basic procedures. Any untrapped errors cause the application to exit.
If you automate your application with Visual Basic or use macro actions that are not trusted, you must ensure either that the user places your database in a trusted location or that you digitally sign the database and instruct the user how to trust the signature. For more about digitally signing a database, see “Packaging and Signing Your Database” on page 1336.
The application should execute the Quit method of the Application object to terminate. If you simply close the final form, the user will be left staring at an empty Access workspace.
The primary sample databases, Conrad Systems Contacts (Contacts.accdb) and Housing Reservations (Housing.accdb), meet the preceding requirements except the startup form is set to frmCopyright to display important information each time you open one of the databases, and the Exit button on the main switchboard form merely closes the form and attempts to return to the Navigation Pane.
If you would like to see what runtime mode looks like, you can test it using existing databases. Open the Housing.accdb desktop database, click the Microsoft Office Button, click Access Options, and then click the Current Database category. In the Application Options section, select frmSplash in the Display Form list, and then click OK. Close the Housing.accdb database. The sample files include a shortcut, Housing Runtime, that opens this database in runtime mode. This shortcut should work as long as you installed the 2007 Microsoft Office system in the default folder (C:\Program Files\Microsoft Office\Office 12) and the sample files in the default folder (C:\Microsoft Press\Access 2007 Inside Out). If necessary, you can change the shortcut by rightclicking the shortcut and selecting Properties on the shortcut menu. The target setting in this shortcut is as follows:
"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE" "C:\Microsoft Press\Access 2007 Inside Out\Housing.accdb" /runtime
After you change the Display Form setting in the Access Options dialog box and correct any settings in the shortcut target, you can double-click the shortcut to start the application in runtime mode. Click OK in the opening message box, and then sign on as any employee of your choosing to see the main switchboard form. Try pressing F11 to see whether anything happens-the Navigation Pane should not appear. You can move around in the application using the command buttons on the various switchboard forms and the buttons on the custom Ribbons. When you click Exit on the main switchboard, code in the form closes all open forms and then closes the switchboard. You’ll be left looking at a blank Access workspace and a very limited set of options when you click the Microsoft Office Button. You can click Close Database from here to close this limited copy of Access or click the Exit button. Be sure to open the Housing.accdb file again, click Exit on the sign-on form, and then change Display Form in the Access Options dialog box back to (none).
|Inside Out-Change the File Extension to Test the Runtime Mode|| |
You can also test your application in runtime mode by changing the file extension on your database. In Windows Explorer, right-click the Housing.accdb sample database file, click Rename, and change the file name to Housing.accdr. Windows prompts you that changing the file extension might make the file unusable. Click Yes in this message box and then open the Housing.accdr database. You’ll see the limited Ribbon, Quick Access Toolbar, and Microsoft Office Button options as you did when using the runtime shortcut.