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.

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 seem 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. Open your sample Plants database and then, 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 of each is the same.

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

    graphics/10fig03.gif

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.

Note

graphics/nman.gif

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 panel of the wizard, you must select all the fields you want in the page. First, select Table: 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 Table: 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.

    graphics/10fig04.gif

  4. In the next panel, 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.

    graphics/10fig05.gif

    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, "Tapping the Power of Relationships.") Click Next when you're ready to continue.

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

  6. In the final panel, 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.

    graphics/10fig06.gif

Note

graphics/nman.gif

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.


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.

graphics/10fig07.gif

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.)

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 can save 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.

graphics/10fig08.gif

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, "Creating and Using Data Entry Forms"; 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.

graphics/10fig09.jpg

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 TypesAndPlants 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 Text Box 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. The Properties window will also show the control's name in its title bar.

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

    graphics/10fig10.jpg

  3. To remove this control from the page, press Delete . This will also delete the associated label control.

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

  5. The next two steps will allow you to modify the plants data. Double-click the TypesWiz header to display that section's properties.

  6. Click the Data tab and then select Plants from the UniqueTable property field's drop-down list.

  7. Save the change by clicking the Save button on the design view toolbar. Confirm changes if prompted to.

  8. 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.

    graphics/10fig11.gif

  9. 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.

    graphics/10fig12.gif



Absolute Beginner's Guide to Microsoft Office Access 2003
Absolute Beginners Guide to Microsoft Office Access 2003
ISBN: 0789729407
EAN: 2147483647
Year: 2002
Pages: 124

Similar book on Amazon

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