Starting a Single-Level Page from Scratch

The Page Wizard and AutoPage have a limited repertoire of page design features, so creating a DAP from scratch or from an existing Web page is an alternative when you want custom page features or to create a DAP to update table values.

Opening new DAP by double-clicking the Create a Data Access Page in Design View item opens the page designer with a page that has the default <TITLE> and <H1> text elements, as well as a single unbound section that's 6 inches wide and 2 inches deep for the U.S. (1033) locale. You use the Field List to bind the page to a Recordset through a record navigation control and add text box and drop-down list controls for lookup fields to the page. Alternatively, you can display data in bound span controls.

Creating a Tabular Page from a Table or Query

The Layout Wizard generates a reasonably attractive tabular page that you can easily customize to meet your graphic design preferences or organization-wide standards.

Tip

As noted earlier in the chapter, tables with lookup fields require drop-down lists to display lookup values. If the table or query for your tabular page has lookup fields, create a new query based on the original table or query with a join to the source table of the lookup data. Add the lookup field to the query's field list, and change the Display Control property value for the original lookup column to Text Box.


To create the starting point of a sample report-type page from a table without lookup fields, do the following:

  1. graphics/data_access_using_wizard.gif graphics/toolbox.gif With Pages active in the Database window, double-click the Create a Data Access Page in Design View shortcut. You might receive a message that you can't open pages that you create with Access 2003 in Access 2000's Page Design view (see Figure 24.35). Mark the Don't Show This Warning Again check box, and click OK to open the empty page. Open the Toolbox and verify that the Control Wizard button of the Toolbox is depressed.

    Figure 24.35. This warning message appears each time that you open a new page in Design view if you don't mark the check box.

    graphics/24fig35.gif

  2. graphics/field_list.gif Click the Field List button if the Field List isn't visible, and drag a table or query node to the extreme left of the empty section. This example uses the Suppliers table. The section border turns blue as you drag the icon into the section. When you release the mouse, the Layout Wizard's single dialog opens.

  3. Select the Tabular layout (see Figure 24.36), and click OK to generate the standard page design. (If you've specified a default theme, the design applies the theme's style sheet).

    Figure 24.36. The Layout Wizard lets you select between columnar and tabular table or query layouts, or add a Spreadsheet, PivotTable, or PivotChart to the page. Wizards usually have multiple dialogs; this "Wizard" dialog is better named "Select Layout."

    graphics/24fig36.jpg

  4. graphics/align_justify.gif Add a title and, optionally, text in the default <H1> section. If the text is short, click Center to center the text under the title.

  5. graphics/subform.gif Change to Page view to display the initial layout. Figure 24.37 shows the default page design for the Suppliers table. The Wizard generates text boxes of equal width for all fields.

    Figure 24.37. The standard tabular page layout places field captions in a Caption section and uses text boxes to permit editing data. The default Recordset type is an updateable snapshot.

    graphics/24fig37.gif

  6. Scroll to the right to display Web hyperlinks that the Wizard adds in a bound span with no column caption.

Setting Group-Level Property Values

The Suppliers table has only 29 records, so it's more convenient for users to display all records instead of navigating in the default groups of 10. When you display all records on a page, there's no need for a navigation control. In addition, you probably don't want users to change the suppliers. You make changes that affect the grouped data in the GroupLevel: TableOrQueryName properties window.

To display all records, remove the navigation control, and prevent editing Suppliers data, do this:

  1. graphics/design_view.gif Return to Page Design view, right-click the page, and choose Group Level Properties to open the GroupLevel: Suppliers window.

  2. Set the AllowAdditions, AllowDeletions, and AllowEdits property values to False to prevent edits to the data.

  3. Optionally, change the AlternateRowColor property value to silver. If you make this change, adjust the depth of the Header section to provide the same spacing above and below the text boxes.

  4. Open the DataPageSize property's list and select All to display all records in a single page.

  5. Set the RecordNavigationSection property value to False to remove the record navigation control (see Figure 24.38).

    Figure 24.38. The GroupLevel properties window lets you set property values that apply to all records in the group.

    graphics/24fig38.gif

  6. graphics/subform.gif Change to Page view to check your work so far (see Figure 24.39).

    Figure 24.39. This double-exposure shows the first six and last three rows of the modified Suppliers list. Setting AllowEdits to False has the same effect as setting the Locked property of Access or Visual Basic text boxes to True.

    graphics/24fig39.gif

Replacing Text Boxes with Bound Span Controls

Bound span controls are a more logical choice for a read-only form than text box controls. As mentioned earlier in the chapter, DAP don't offer an automated method for changing control types. To change the control type created when dragging fields from the Field List, you must change the DefaultControlType property value of the page from Text Box to Bound Span.

To replace the text boxes in the Header section with bound span controls, do this:

  1. graphics/design_view.gif Change to Page Design view, right-click the page, and choose Page Properties to open the Page: Page1 properties window.

  2. Click the Data tab and change the DefaultControlType property value to Bound Span.

  3. While you have the properties window open, click the Other tab and change the Title property value to Northwind Suppliers List. Close the properties window.

  4. Delete all the text boxes in the header section. As you delete the text boxes, the captions disappear. Reduce the width of the Header section to about 6.25 inches. (Reducing the width of the Header section also shrinks the Caption section.)

  5. graphics/field_list.gif Expand the Suppliers node of the Field List, and drag the SupplierID field to the extreme left of the Header section. The tabular format adds the bound span control to the Header section and adds the label to the Caption section. Change the label text to ID, and decrease the width of the label and span.

  6. Repeat step 5 for each of the fields that you need in the list. Adjust the width of the span and label to accommodate the approximate length of the field's data.

  7. graphics/bold.gif Optionally, select all the text boxes and apply the Bold attribute. A bold font makes the data more readable if you applied the silver color to alternate rows.

  8. The list is more useful if you sort by company name, not ID number, so open the GroupLevel: Suppliers properties window and specify CompanyName as the value of the DefaultSort property (see Figure 24.40).

    Figure 24.40. Replacing text boxes with span controls improves the appearance of the form and requires less vertical space per row. Sorting on the CompanyName field improves the usability of the list.

    graphics/24fig40.jpg

  9. Choose File, Save As, and save your page as Suppliers List; save the file as SuppliersList.htm, and then open it in Web Page Preview (see Figure 24.41). Click OK to acknowledge the absolute path warning message.

    Figure 24.41. Web Page Preview shows the result of this section's redesign.

    graphics/24fig41.jpg

Publishing limits preclude listing all the property values of page objects; most objects have many more properties than their native Access counterparts. The preceding sections are only an introduction to customizing the content and design of DAP.

Tip

Experiment freely with changes to Page, Group Level, Object, and Element properties. It's easy to undo changes that aren't what you intend.


graphics/power_tools.gif

The completed SuppliersList.htm page is located in the \Seua11\Chaptr24 folder of the accompanying CD-ROM.



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

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