Creating Multiple-Page Forms


As you’ve seen, Access 2007 makes it easy to display a lot of related information about one subject in a single form, either by using a query as the source of the form or by displaying the related information in a subform. As described in the previous section, if you have too much information to fit in a single, screen-sized form, you can use the tab control. Another way to handle the problem is to split the form into multiple pages.

In Chapter 2, “Exploring the New Look of Access 2007,” you learned about the Document Window Options settings in the Access Options dialog box. In previous versions of Access, all objects opened in their own windows where you could edit, view, or print them. This multiple-document interface made multiple-page forms a good method of displaying a lot of information on one form. The ContactsDataCopy.accdb sample database you have been using uses the single-document interface, which shows all open objects in a series of tabs along the top of the object window to the right of the Navigation Pane. Unless you know in advance the height of the Access workspace, it’s difficult to design a multiple-page form that works smoothly in the single-document interface. To see how a multiple-page form works in the multiple-document interface, you should close the ContactsDataCopy.accdb database and open the Contacts.accdb database that uses the multiple-document interface.

You can create a form that’s up to 22 logical inches high. If you’re working on a basic 1024-by-768-pixel screen, you cannot see more than about 5.6 logical inches vertically at one time (if the Ribbon is displayed). If the information you need to make available in the form won’t fit in that height, you can split the form into multiple pages by using a page break control. When you view the form, you can use the Page Up and Page Down keys to move easily through the pages.

Creating a smoothly working multiple-page form takes some planning. First, you should plan to make all pages the same height. If the pages aren’t all the same size, you’ll get choppy movement using the Page Up and Page Down keys. Second, you should design the form so that the page break control is in a horizontal area by itself. If the page break control overlaps other controls, your data might be displayed across the page boundary. You also need to be aware that when you set the form’s Auto Resize property to Yes, Access sizes the form to the tallest page.

The frmXmplContactsPagesChap13 form in the Contacts.accdb database is a good example of a multiple-page form. If you open the form in Design view, open the Property Sheet window, and select the Detail section of the form, you can see that the height of this area is exactly 5.8 inches. If you click the page break control, shown at the left edge of the Detail section in Figure 13–34, you’ll find that it’s set at 2.9 inches from the top of the page. Because this is exactly half the height of the Detail section, the page break control splits the section into two equally sized pages.

image from book
Figure 13–34: The frmXmplContactsPages form includes a page break control that splits the Detail section exactly in half.

When you look at this form in Form view (as shown in Figures 13–35 and 13–36) and use the Page Up and Page Down keys, you’ll see that the form moves smoothly from page to page. If you switched from Design view to Form view, you must first click the Size To Fit Form button in the Window group on the Home tab to see the form page up and down correctly. When you open this form from the Navigation Pane, it sizes correctly because the form has its Auto Resize property set to Yes.

image from book
Figure 13–35: This is the first page of the frmXmplContactsPages form.

image from book
Figure 13–36: When you press Page Down, you can see the second page of the frmXmplContactsPages form.

If you’re in a control on the second page of the form and you press Page Down again, you’ll move smoothly to the second page of the next record. Note that certain key information (such as the contact name) is duplicated on the second page so that it’s always clear which record you’re editing. If you look at the second page of the form in Design view, you’ll find a locked text box control at the top of the second page that displays the contact name again.

A key form property that makes multiple-page forms work is the Cycle property. On this sample form, the Cycle property is set to Current Page. As you learned in Table 12–11 on page 676, other options are All Records (the default) and Current Record. If you don’t set the Cycle property to Current Page, you must place the first and last controls on a page that can receive the focus exactly on the page boundary. If you don’t do this, you’ll find that the form scrolls partially down into the subsequent page as you tab from the last control on one page to the first control on the next page. Because it’s not likely that you’ll design your form with controls exactly aligned on the page boundary, you must use some special techniques to properly align form pages if you want to allow tabbing between pages or records. See “Controlling Tabbing on a Multiple-Page Form” on page 1080 for details. You can now close the Contacts.accdb database.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

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