Home > Articles > Data > Access

  • Print
  • + Share This

Using Wizards to Generate Web Pages

Well-understood problems can be automated. Just as forms represent well-understood problems, creating a basic Web page that contains data is quickly falling into the category of understood problems. As tools evolve, it is easier to express an understanding in the context of a tool.

As with many other aspects of Access 2000 development, there are wizards that can help you create a data access page. To view the list of wizards, open the eSoft database, click the Pages button in the Object view, and click New. The wizards are Design View, Existing Web Page, Page Wizard, and AutoPage: Columnar (see Figure 2).

Figure 2 The New Data Access Page dialog box listing the available wizards.

The Design View Wizard opens a blank page. This will require more work than customizing a wizard-generated page. The Existing Web Page Wizard opens the Locate Web Page Explorer; use the Explorer to find and open an existing page. Recall that data access pages are stored outside the Access database, although Access stores a reference to the physical location of the page. The AutoPage: Columnar Wizard requires the least work but offers the least amount of wizard customization. To use this wizard, simply click New, select the AutoPage Wizard, select a table, and click OK. The Page Wizard balances ease of use with flexibility; therefore, I will go over the steps necessary to create a page using this wizard.

To demonstrate the Page Wizard, let's create a useful query that combines the lookup data from the DEPARTMENT and ROLES tables.

Defining a Multiple-Table Query

The query used in this section joins the EMPLOYEE, DEPARTMENT, and ROLES tables so that you can see the name of the department and role instead of the ID.

NOTE

Indexed fields that are used to logically join tables such as DEPARTMENT_ID, ROLE_ID, and EMPLOYEE_ID should never be displayed to users except those who are administrators. Generally these fields exist to equate lookup data or associated data. It is the data in equated tables that you want to show.

The previous paragraph defines the necessity for a join relationship. The SQL in this section demonstrates such a join.

Create the query in Listing 2 and save it as QUERY_EMPLOYEE_PHONELIST_BY_DEPARTMENT.

Listing 2  Definition of a Multiple-Table Relationship That Contains Lookup Data

1:  SELECT DEPARTMENT.DEPARTMENT_ID, DEPARTMENT.NAME AS DEPARTMENT_NAME,
2:  EMPLOYEE.FIRST_NAME, EMPLOYEE.LAST_NAME, EMPLOYEE.PHONE_NUMBER,
3:  EMPLOYEE.EXTENSION, ROLES.NAME AS ROLE
4:  FROM (DEPARTMENT
5:  LEFT JOIN EMPLOYEE ON DEPARTMENT.DEPARTMENT_ID = EMPLOYEE.DEPARTMENT_ID)
6:  LEFT JOIN ROLES ON EMPLOYEE.ROLE_ID = ROLES.ROLE_ID
7:  ORDER BY EMPLOYEE.LAST_NAME;

The query returns the fields DEPARTMENT, DEPARTMENT_ID, DEPARTMENT.NAME, EMPLOYEE.FIRST_NAME, EMPLOYEE.LAST_NAME, EMPLOYEE.PHONE_NUMBER, EMPLOYEE.EXTENSION, and ROLES.NAME. The tables read are DEPARTMENT, EMPLOYEE, and ROLES. Because this query joins multiple tables, it will result in a read-only query. For an employee directory listing, this is exactly what you want.

Using the Page Wizard

Using the query from the preceding section, you can use the Page Wizard to complete the employee directory. Follow these steps to complete the data access page:

  1. With the eSoft database open, click the Pages button in Object view.

  2. In the New Data Access Page, select Page Wizard and the query created in the last section, QUERY_EMPLOYEE_PHONE_LIST_BY_DEPARTMENT.

  3. Click OK.

  4. In the first step of the Page Wizard, select all the available fields except the DEPARTMENT_ID.

  5. Click Next.

  6. Click Next again. (If you want to group the result set on a particular column or columns, you can indicate the groupings of columns on the second page of the wizard.)

  7. On the sort page of the wizard (the third page), add the LAST_NAME column as a sort field.

  8. Click Next.

  9. Keep the defaults on the last page of the wizard; click Finish.

CAUTION

Because the query is read-only, you must add test data to the tables in order to have data to browse in the completed Web page. You can open the tables and add data in the Table view.

A completely functional Web page results. Figure 3 depicts the Web page in Design view after the wizard completes. To test the page, click View, Page View. The navigation control (shown in Figure 3) can be used to navigate through each of the records in the result set.

Figure 3 The Employee Directory data access page created by the Page Wizard.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.