Using Web Page Design Tools
After you have a Web page, you can use Access 2000, the toolbox, and germane menu items to visually customize the data access page. It is important to note at this point that the page can be used as is.
Taking a Tour of Data Access Page Menus and Toolbars
Access 2000 displays context menus. That is, it shows and hides menus based upon the activity you are performing. This section will cover the relevant menus, toolbars, and dialog boxes that will help you customize data access pages.
When you have a data access page opened and in focus in Design view, several menu items are useful. Table 4 lists the menus and menu items and gives a description of their utility.
Table 4 Relevant Data Access Page Menus
Menu Name | Item/Command | Description |
File | Web Page Preview | Opens the page in the default Web browser. |
View | Design View | Uses page design mode. |
View | Page View | Enables you to browse or modify data. |
View | Properties | Enables you to modify selected control properties at design time (see Figure 4). |
View | Field List | Displays all the fields from all tables and queries. These are used to bind a data source to a control (see Figure 5). |
View | HTML Source | Enables you to view and edit the HTML source code that defines the page. |
View | Sorting and Grouping | Allows you to edit sorting and grouping expressions for the data access page (see Figure 6). |
View | Toolbox | Opens the toolbox dialog box. Drags and drops controls from the toolbox onto the data access page in design mode to customize the page (shown in Figure 7). |
Insert | Movie from file | Inserts a movie (.mov, .avi, .mpeg, or .asf) file into the page. |
Insert | Picture | Inserts a bitmap file (.gif, .jpg, .jpeg, .bmp, .xmp, or .png formatted) image into the page. |
Insert | Office Chart | Inserts a graph (called a chart) into the page. You can bind the chart to a table to represent dynamic data. |
Insert | Office Pivot Table | Inserts a pivot table into the page. A pivot table enables you to dynamically change the way in which data is presented. |
Insert | Office Spreadsheet | Inserts a spreadsheet into the page. The spreadsheet can be dynamically bound to data from your database. |
Insert | Hyperlink | Inserts a hyperlink tag (see the previous section "Understanding Web Pages" for more information) into the page. |
Insert | ActiveX Control | Inserts an external object, such as Microsoft NetShow player, which enables you to incorporate streaming audio and video into your page. |
Insert | Unbound Section | Inserts a part of a data access page, such as a header, footer, or detail section. |
Format | Theme | Enables you to apply a theme to a Web page. A theme contains background information, color schemes, and other information that describes the general appearance of a page. |
Format | Background|Color | Specifies the background color of the page. |
Format | Background|Picture | Specifies a background graphic for the page |
Format | Background|Sound | Adds a sound file containing containing that is played when the page is opened. |
Figure 4 The Properties dialog box enables you to modify object properties at design time (as well as with code).
Figure 5 The Field List dialog box contains all the fields available from Table and Query data sources. These are used to associate data with controls.
Figure 6 The Sorting and Grouping dialog box enables you to create sorting and grouping expressions for the data sources associated with your page.
Figure 7 The toolbox contains controls that you can drag and drop onto your data access page to customize the implementation of the page.
The menus in Table 4 make it easier to create a data access page. Menus generate the HTML code to accomplish the task indicated by the menu item. Using the menus is easier than writing the code. Of course, you can do either.
Adding a Control to a Data Access Page
The visual appearance of a data access page is contrived by combining fonts, color, text, and graphics to create a visual effect. The utility of a data access page is created by adding controls that can be bound to (associated with) a data access page. However, the process of adding a control is the same whether or not it contains data. To add a control to a page, follow these steps:
-
Click View, Toolbox to open the toolbox dialog box.
-
Click the control you want to add to the page.
-
Move the mouse pointer over the page where you want to paint the control, and click the left mouse button.
Modify the properties to finish the appearance of the control and utility of the control, depending on what you want to do with that control.
Using the Properties Dialog Box
The Properties dialog box is a visual interface that effectively enables you to produce the same result as you would if you wrote code to modify a property. The difference between the two is that code is run when your programming runs. The Properties dialog box, however, allows you to modify properties of controls without writing any code, at design time.
A visual, design-time interface distinguishes a RAD development environment from a non-RAD development environment. To modify properties, when you have a data access page open in Design view, click on the control you want to modify:
-
Click View, Properties.
-
In the Properties dialog box, find the name of the property you want to modify.
-
Enter a new value for the property.
You see the result immediately. Try an example by following these steps:
-
Open the Employee Directory data access page. (You are going to modify the labels from the field names in uppercase to a more readable format.)
-
Click on the DEPARTMENT_NAME text on the page.
-
Click View, Properties.
-
Click the Other tab.
-
Find the property InnerText (property names are on the left and property values are on the right).
-
Change the property value to Department Name, which looks nicer than DEPARTMENT_NAME.
To practice changing text properties, repeat the process, changing all the uppercase field labels to a nicely formatted version for each label.
Binding a Field to a Control
Binding a field to a control means that, in the Properties dialog box, you set the Control Source property on the Data tab to the name of the field from which data will be read and to which it will be written (if the page is writeable). The record set is established by placing the control on a bound section. The Record Source property of the bound section contains the record set value.
To add a text box to the Employee Directory page, open the toolbox and paint a text box control to the right of the existing controls. Notice that a label (an MSTheme-Label) is also painted. To bind this control to the DEPARTMENT_ID, follow these numbered steps:
-
Click on the text box control after it is painted on the form.
-
Click View, Properties.
-
Click the Data tab in the Properties dialog box.
-
Click on the drop-down list button (which appears when you click on the property) to drop down the list of fields.
-
Select the DEPARTMENT_ID field.
-
Click on the adjacent text label and modify the inner text to Department ID.
This process is automated by the wizard, but you must know how to do it manually, if you want to bind any controls other than the text box controlthe default control added by the wizard.
Sorting and Grouping Data
The Sorting and Grouping dialog box in Figure 6 enables you to customize the organization of the data and some specifics about how the page appears. The properties for sorting and grouping are described in Table 5.
Table 5 Sorting and Grouping Properties Define the Appearance of a Bound Section
Group Property Name |
Description |
Caption Section |
Adds a section for a caption if Yes. (The default is No.) |
Group Header |
Adds a group header section (see Figure 3). (The default is Yes.) |
Group Footer |
Adds a group footer section. (The default is No.) |
Record Navigation Section |
Displays a navigator control. The default is Yes; if you change this to No, you must devise an alternate means of navigating records. |
Expanded by Default |
Has a default of No, but if your page has multiple groups, you can set this to Yes to have the groups fully expanded. |
Data Page Size |
Has a default of 1that is, only one record will be displayed per page. Change it to a greater number to return multiple records per page. |
Group On |
Specifies the value or range of values that start a new group. |
Group Interval |
Is any value that is valid for the group. For example, if you are grouping on months, 3 is an appropriate interval. An interval of three months groups dates by quarters. |
Default Sort |
Is equivalent to the ORDER BY sort clause for a query. |
Group Filter Control |
Is the name of a combo box or list box control that contains filter data. |
Group Filter Field |
Is the name of the field that the group control will filter on. |
There is a wide range of property settings that will provide precise control over your data access page. For example, you can add a drop-down list control to filter on employee roles in the employee directory. Complete the numbered steps to try it out.
-
Open the employee directory in Design view.
-
Paint a drop-down list control from the toolbox to the page.
-
Complete the wizard that appears when you drop the control onto the page.
-
In the wizard, when prompted for a table, select the ROLES table. Add the ROLE_ID and NAME to the selected fields. Name the drop-down list control RoleFilter.
-
After you have completed the wizard, open the Properties dialog box for the RoleFilter drop-down list control.
-
Change the List Bound Field to Name.
-
Open the Sorting and Grouping dialog box, and enter the value RoleFilter for the GroupFilterControl and ROLE for the Group Filter Field.
Click View, Page View to test the filter. (You will need to add some test data to test the filter.) When you change the value of the filter, only those records containing the filtered role should be navigable.