Export (0) Print
Expand All
28 out of 40 rated this helpful - Rate this topic

Using Navigation Forms in Access 2010

Office 2010

Office Visual How To

Summary:  Create web and client-focused interfaces using a common design style using navigation forms in Microsoft Access 2010.

Applies to:  Microsoft Office 2010 | Microsoft Access 2010

Published:  July 2010

Provided by:  Ken Getz, MCW Technologies, LLC

Overview

It is common, in web applications, to see main menu items across the top of a page, with sub-items either under the main menu or on the left or right side of the page. Access 2010 is designed to make it easy to create web-targeted database applications, and the new navigation forms feature makes it easy to create standard user interfaces for the web. In addition, these interfaces can be useful in client applications. This Visual How To shows how to create an Access 2010 form by using the new navigation forms feature and will investigate the sample form that is shown in Figure 1.

Figure 1. Sample form

Sample form

 

Code It

In Access 2010, open the Northwind sample database. (To retrieve the Northwind sample database, select File, select New, then select Samples. From the list of Office.com samples, select Northwind 2007.) Open the new sample database, bypass the logon form, and in the Navigation Pane, group the objects by type. In the Create tab, select the Navigation option, which displays the six different layouts from which you can select when you are creating a navigation form (see Figure 2). You can select to arrange navigation tabs across the top in a single row, or across the left or right sides of the form. For multiple levels of tabs, you can position them in two rows on the top of the form, or across the top and then down the left or right side of the form. For this example, select Horizontal Tabs and Vertical Tabs, Left. Click the title, Navigation Form, and change it to Manage Entities. When you are finished, the form should resemble Figure 3.

Figure 2. Navigation form layout selections

Navigation form layout selections

Figure 3 shows a form with a modified title.

Figure 3. Form with modified title

Form with modified title

Create the Top-Level Tabs

The sample form should display top-level options to work with customers, employees, and products. To get started, click the Add New button at the top of the navigation form, and change the text to Customers; Access will add a new tab. Repeat this process, creating tabs for Employees and Products. When you are finished, the tabs should resemble Figure 4.

Figure 4. Top-level tabs layout

Top-level tabs layout

Create the Second-Level Tabs

With the top-level tabs, it is easy to add forms and reports to be displayed when users click secondary tabs, on the left side of the form. Start by clicking the Customers top-level tab. From the Navigation Pane, drag the Customer List form onto the Add New tab on the left side of the form. This creates a new connection between the navigation button and the existing form, setting the button Navigation Target Name property so that it refers to the specified form. Repeat this process, adding the Customer Phone Book and Customer Address Book reports to the tabs on the left.

Click the Employees tab at the top of the form, and from the Navigation Pane, drag the Employees List form to the Add New tab on the left of the form. Repeat this step with the Employee Address Book and Employee Phone Book reports. Click the Products tab at the top, and drag the Product Details form to the tabs on the left. Repeat this step with the four product-related reports. Save the new form with the name Entities. Now, the form should resemble Figure 1. Display the form in Form view, and interact with the various tabs, moving from Contacts to Employees to Products, and verify that the second-level tabs work correctly.

Read It

The following section includes information about how to style the navigation form.

Styling the Navigation Form

So far, you have only worked with the default style for the navigation form. You can control the look of each button and you can apply styles to all buttons at the same time. To try this out, switch back to Layout view. Then, click the Customers tab at the top. Click the top tab on the left, and then press CTRL and click the remaining two tabs on the left. In the ribbon, select the Format tab, and then click the Quick Styles drop-down box, as shown in Figure 5. Select one of the styles to configure the style for all the selected buttons.

Figure 5. Using Quick Styles to format tabs

Using Quick Styles to format tabs

To configure the shape of the buttons, select the Change Shape drop-down box, as shown in Figure 6. By using the same set of buttons selected, select the round option. (You can also add other effects by using the Shape Fill, Shape Outline, and Shape Effects tools on the ribbon. When changed to circular shapes with a glow effect, the buttons should resemble those in Figure 7.

Figure 6. Changing the tab shape

Changing the tab shape

Figure 7 shows the buttons after shape changes.

Figure 7. After changing the shape of the selected buttons

After changing the shape of the selected buttons

Comparing the Navigation Form to the Tab Control

You may wonder why you might use the new navigation form feature instead of the standard Tab control, which provides similar functionality. One reason, of course, is that the Tab control does not provide a mechanism for supporting a hierarchy of options, as does the navigation form. To enable users to select a main category, and then select sub-categories, the navigation form is the only choice.

In addition, the load-time behavior is different for the two types of controls. The navigation form loads each child form or report on demand (that is, as you click the corresponding tab). The Tab control, however, loads all its child objects as it loads. Not only does this affect performance (when you open the main form, you must wait while the Tab control loads all its child objects), but it can also make it difficult when handling querying data. Because the navigation form loads each form as you click the corresponding tab, you can be certain that users see the most current data, without a need for you to create specific code that re-queries the form as users click each tab. This also means that the navigation form does not provide a specific event as you click each tab. Instead, place the load-time code in each form or report Load or Open event handler.

noteNote:

Navigation forms work only in Access 2010. If you attempt to open a form that includes the navigation form container in Access 2007 and earlier versions, the operation will fail.

See It

Watch the video

Watch video

Length: 06:53

Explore It

About the Author
Ken Getz is a senior consultant with MCW Technologies. He is coauthor of ASP.NET Developers Jumpstart (Addison-Wesley, 2002), Access Developer's Handbook (Sybex, 2001), and VBA Developer's Handbook, 2nd Edition (Sybex, 2001).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.