Creating Simple Pages

Now that you're familiar with the page object, let's look at the various ways you can create one. As you might expect, there's more than one way to create a page. You can

  • Use the AutoPage Wizard.

  • Use the Page Wizard.

  • Save an existing form or report as a page.

  • Save an existing Web page as a page.

  • Create the page yourself in page design view.



A lookup field is a table-level user -defined data type that stores a value other than the value it displays. Learn more about lookup fields and how to create them in Chapter 6, "Tapping the Power of Relationships."

Running the AutoPage Wizard

By now, you can probably guess that the easiest way to create a page is to use a wizard. At this point, you've used wizards to create several objects, queries, forms, and reports , so the following section will probably be familiar to you.

You can choose from two wizardsthe AutoPage wizard and the Page Wizard. The AutoPage Wizard includes all the data in a fixed format ( columnar ). In this example, you'll use the AutoPage Wizard to create your first page based on the Plants table. To do so, follow these steps:

  1. Click the Tables shortcut in the Database window.

  2. Select Plants .

  3. Select Page from the New Object button's drop-down list, or select Page from the Insert menu.

  4. Select AutoPage: Columnar in the New Data Access Page dialog box.

  5. You can change (or choose) the data source from the drop-down control at the bottom of the dialog box. In this case, the control already displays Plants because we selected that table before we launched the wizard. Click OK to create the page shown in Figure 10.3. The page will display all the fields and all the records in the Plants table. As you can see, the page also contains familiar icons for many navigation tasks , including moving between records, sorting, and filtering. The arrangement of these controls is a bit different from that on forms, but the basic function is the same.

    Figure 10.3. Using the AutoPage Wizard to create this page.


By now, you're probably familiar with the columnar format the wizard uses and the navigation tools you'll use to browse the records. These tools serve the same purpose they do in a table, form, or report.



You might have noticed that the page based on the Plants table doesn't display the pictures added in Chapter 8, "Creating and Using Data Entry Forms." In addition, the TypeID field in the Plants table is a lookup field. You might recall from Chapter 8 that forms inherit this data type and automatically display a drop-down control to accommodate the field's list. Unfortunately, a page object doesn't do this because it doesn't support lookup fields.

Using the Page Wizard

The Page Wizard takes a few more clicks, but you can better control the results. In this example, you'll use this wizard to create a page based on two of your tables, Plants and Types. More specifically , you'll group all the plants of a specific type. Follow these steps:

  1. Launch the Page Wizard by selecting Page either from the New Object button's drop-down list or from the Insert menu. Then, select Page Wizard from the resulting New Data Access Page dialog box and click OK .

  2. In the first window, you must select all the fields you want in the page. First, select Types from the Tables/Queries drop-down control; then click the double arrow button to move all the fields in Types to the Selected Fields list.

  3. Select Plants from the Tables/Queries drop-down control and move all those fields to the Selected Fields list. Figure 10.4 shows all the fields in the Selected Fields list. Click Next to continue.

    Figure 10.4. Move all the fields from both the Plants and the Types tables to the Selected Fields list.


  4. In the next window, you can group the records by the type value. Select the Types.TypeID item in the list to the left; then click the single right arrow button to create a group based on that field (see Figure 10.5). The control to the right updates according to your grouping selection.

    Figure 10.5. Group the page by the type values.


    Notice that the list contains two TypeID fields. That's because both tables have a TypeID fieldit's a primary key in the Types table and a foreign key in the Plants table. (You can learn more about primary and foreign keys in Chapter 4, "Planning a Database," and Chapter 6.) Click Next when you're ready to continue.

  5. We won't use the following window in our example, but you could sort records in this window. Click Next .

  6. In the final window, enter a new name for the page (or accept the wizard's choice). We named ours TypesAndPlants, as shown in Figure 10.6. Select the Open the Page option, and then click Finish to create the page.

    Figure 10.6. Name the page.


Initially, the page shows only the type fields and has only two type records (remember, the database doesn't have any records for type 2 yet). With the page displaying the record for type 1, click the Expand control (the + symbol) to see all the plants that match that type, as shown in Figure 10.7.

Figure 10.7. Display type 1 plants.


Interestingly, the page displays a second navigation bar so you can browse all the plants that match the current type. This behavior is similar to forms and subformsboth display their own navigation bar as well. You can browse records in both sections with the plant group fully expanded. However, if you collapse that section, you won't see the matching plants as you browse the type records.

You might want to tweak the results a bit. The current page displays the TypeID value twice. After you're familiar with pages, correcting such a minor problem will be a snap. (Learn how to modify a page in the section "A Peek at Page Design View," later in this chapter.)



Did you notice that most of the buttons on the navigation bar are disabled? That's because this page can only display data. When a page is based on more than one table or query, you must decide which table the page can update; otherwise , it will update nothing.

To set the appropriate property, open the page in design view, select the appropriate data section, open the Properties window, click the Data tab, and set the UniqueTable property to the table you want to update.

Saving a Form or Report As a Page

You might already have the beginnings of your page in an existing form or report. That happens frequently if you're expanding an existing database application to an intranet. Fortunately, Access saves that form or report as a page object. You won't always get the exact results you need, but sometimes a form or report provides a good starting place. Let's see what happens when you save the Plants form you created in Chapter 8 as a page. Do the following:

  1. Click the Forms shortcut on the Database window's Object bar.

  2. Highlight Plants in the list of forms.

  3. Select Save As from the File menu.

  4. In the resulting dialog box, give the page a name and select Data Access Page from the drop-down control. We named our new page PlantsSavedFromForm.

  5. Click OK .

  6. In the New Data Access Page dialog box, you can select a new location in which to store the page. To save it in the same folder as your database, accept the default choices. Click OK .

Figure 10.8 shows the new page. It's similar to the page shown in Figure 10.3, but the record selector to the left is a good clue that the page started as a form.

Figure 10.8. A page created by saving the Plants form as a page.


A Peek at Page Design View

So far, you've viewed all your new pages in page view. However, you can also view (and modify) the page object in design view. The process is similar to modifying tables, queries, forms, and reports in design view (we reviewed design view for other objects in Chapter 5, "Building Your First Tables"; Chapter 7, "Retrieving Data with Queries"; Chapter 8; and Chapter 9, "Printing Information with Reports"). In design view, you can change the way the page looks and even the data with which it interacts .

Figure 10.9 shows the TypesAndPlants page created earlier in design view.

Figure 10.9. A page in design view.


You'll be using several windows to modify a page. Sometimes it can get crowded, which is why Access lets you display and hide these windows as you need them by clicking the appropriate button on the Page Design toolbar or selecting the window from the View menu. Feel free to display these windows and familiarize yourself with them. They are as follows :

  • Field List Lists all the fields you can include in the page (refer to Figure 10.9).

  • Data Outline window Displays the page's structure in a tree view hierarchy. This window displays the data source and all the fields, including any calculated controls the page might have. A calculated control displays the results of an expression.

  • Toolbox Always found in design view for all objects. The tools it offers change from object to object, and page controls are unique to the page object.

  • Properties window Lets you change the properties for the page and its controls. The properties are always unique and specific to the current object.

Now, let's make a few changes to the PlantsAndTypes page in Design view. Perform the following steps:

  1. Open the page in design view, if you haven't already. (Click the Design button on the Page view toolbar.)

  2. Select the Plants_TypeID control (just below the Notes control). You'll know it's selected because it will have selection handles around it, as shown in Figure 10.10.

    Figure 10.10. Access displays selection handles around a control's border when it's selected.


  3. To remove this control from the page, press Delete .

  4. Select the CatalogName control and drag it up to fill in the empty space left by the Plants_TypeID control.

  5. Save the change by clicking the Save button on the Design view toolbar.

  6. Next, drag the Description control to the right of the Types_TypeID control in the page's header section. At this point, your page should resemble the one shown in Figure 10.11.

    Figure 10.11. After making your changes, your page will look like this one in design view.


  7. Click View on the Design toolbar to return the page to page view. Then, click the Expand control (+) to display the plants for the current type, as shown in Figure 10.12. The duplicate TypeID control is gone, and the Description and TypeID controls are now side by side.

    Figure 10.12. Display the modified form in page view.


Absolute Beginner's Guide to MicrosoftR Access 2002
Absolute Beginner's Guide to MicrosoftR Access 2002
Year: 2002
Pages: 133 © 2008-2017.
If you may any questions please contact us: