Controlling the Features Available to Database Users


If your database will be used by people with little or no experience with Access, you might want to control which features are available when a database opens. There are several ways to do this. If you want users to be able to open only one database, you can add one or more options to the Access desktop shortcut and Start menu link. These options can open a specific database, run macros, and perform other tasks. For more information about the available options, search Microsoft Office Access Help for Command-line switches.

A more common way to control the user's environment is to set startup options in each database. You can use startup options to control the menus and Ribbon tabs available to the user, the initial form displayed (such as a switchboard), and other features. The startup form can include macros and VBA procedures that run automatically to set other conditions.

In this exercise, you will set startup options that tie together a switchboard and some custom menus to create a version of the database that is appropriate for inexperienced users. You will experiment with these options, and then bypass them.

Tip

This exercise uses custom menus that were created specially for the sample database. For more information about how to create menus such as these, search for AddMenu in the Access Help system.

The Orders form in this exercise uses several custom macros. You can review these macros by clicking Macros on the Objects bar and then opening orderForm in Design view.


USE the 03_Features database and the 03_Icon icon. These practice files are located in the Chapter09 subfolder under SBS_Access2007.

OPEN the 03_Features database.


1.

Click the Microsoft Office Button, and in the lower-right corner of the menu, click Access Options.

2.

In the left pane of the Access Options window, click Current Database.

Access displays the options for the current database.

3.

In the Application Options area, type Features in the Application Title box, and then press the key.

Access displays the text you entered in the database title bar, in place of the usual Microsoft Access title.

4.

Click the Browse button to the right of the Application Icon box. In the Icon Browser dialog box, navigate to the Documents\MSP\SBS_Access2007\Chapter09 folder, and then double-click the 03_Icon icon.

5.

Below the Application Icon box, click Use as Form and Report Icon.

The selected icon will appear at the left end of form and report title bars, or on their tabs, depending on the navigation properties you have set.

6.

Click the Display Form arrow, and then in the list, click Switchboard.

This switchboard will be displayed each time the database is opened.

Tip

With the Use Access Special keys check box selected, the following special key combinations are available to database users.

F11 shows and hides the Navigation Pane.

Ctrl+G shows the Immediate window in the Visual Basic Editor.

Alt+F11 switches to the Visual Basic Editor.

Ctrl+Break stops Access from retrieving records from the server.

It is useful to have these options available while developing a database, but you might want to disable them before you make the database available to other users.

7.

Clear the Display Navigation Pane check box.

This prevents the Navigation Pane from initially being displayed. If you disable the use of Access Special keys, the user won't be able to display the Navigation Pane at all.

8.

In the Ribbon and Toolbar Options area, clear the Allow Full Menus and Allow Default Shortcut Menus check boxes.

By disabling these options, you prevent the user from having access to these tools, which helps prevent inappropriate changes to the database. All they will see is the Home tab and any Add-In menus you create.

Tip

With the default Shortcut Menu Bar selected in the Ribbon And Toolbar area, the standard shortcut menu appears when a user right-clicks a form. You can also create a custom shortcut menu and specify it in this window or in the form's properties, to provide just the necessary commands.

9.

In the Access Options window, click OK.

Most startup options don't go into effect until you close and reopen the database. The only changes you should see now are the name in the Access window's title bar and the icon in the forms and reports.

10.

Close and reopen the 03_Features database.

Access displays the selected startup options: you see the new title bar, the Home tab, and the Switchboard. From the first exercise in this chapter you are familiar with the process of using the Switchboard to work with forms and reports. You can still do this in the current database, but we have also created an Add-In menu and attached it to the Switchboard form, so when that form is active, the Add-In menu is displayed.

11.

Press .

This Access Special Key displays or hides the Navigation Paneif you don't want database users to have this ability, you will probably wnt to disable the Access Special Keys.

12.

On the Add-Ins tab, in the Menu Commands group, click Forms, and then in the list, click Edit/Enter Categories.

The form appears on a new document tab. Note that the Add-Ins menu tab has disappeared. This menu is visible only while the object to which it is attached is active.

13.

Close the Categories form.

Note that the Switchboard is again active, and the Add-Ins menu is again visible.

14.

In the Menu Commands group, on the Forms list, click Edit/Enter Orders.

The Orders form is displayed, but this time the Add-Ins menu remains visible. This is because it is attached to both the Switchboard form and the Orders form. There is no way for you to see how this is done in the current database, as most advanced functionality has been disabled by your settings in the Access Options.

15.

Close the 03_Features database.

16.

While holding down the key, open the 03_Features database. If a safety warning appears, continue to hold the key down while you acknowledge the warning.

Holding down the Shift key while you open the database bypasses all the startup options, so the database starts the same way it did before you set those options.

Tip

The only way to prevent a user from bypassing your startup options is to write and run a VBA procedure that creates the AllowByPassKey property and sets it to False. There is no way to set this property through Access. For information about how to do this, search for AllowByPassKey in the Visual Basic Editor Help file.

17.

Open the Orders form in Design view, and then display its Property Sheet pane. Click the Other tab, and note the setting for Menu Bar. It should be set to sbMenu.

You attach a menu to a form or report by setting the Menu Bar property to the name of a macro. That macro (sbMenu in this case) lists the names of the menus to add to the menu Command group on the Add-Ins tab. It also points to other macros (TG1 and TG2 in this case) for information about the commands to display on each menu and the actions to take when they are clicked.

You can open sbMenu, TG1, and TG2 in design view to see what they contain. If you want to learn more about this, or create your own menus, search for addmenu in the Access Help system.

You could create different menus for every form and report in your database, and use them in conjunction with custom groups or a switchboard to provide a great deal of control over what your users can do in the database.

CLOSE the 03_Features database.




MicrosoftR Office AccessT 2007 Step by Step
MicrosoftR Office AccessT 2007 Step by Step
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net