Completing the Main Personnel Actions Entry Form

In the following sections, you learn how to use the Control Wizards to help you add a subform to a form. Before you add the subform, however, you should complete the main frmPersonnelActionsEntry form. Like the form that you created with the Form Wizard in Chapter 12, the purpose of this form is to display records from the Personnel Actions table so that a user can view the history of an employee's personnel actions. The form also conveniently provides a means of adding new personnel action records.

In the form you created in Chapter 12, you viewed the history of personnel records and also added new records in a tabular subform, while information from the Employees table was displayed only on the main form. In this custom form, you place fields from the Personnel Actions table on the main form to make adding new records to the Personnel Actions table easier, and the Tab control is used to contain the subform as well as additional information from the Employees table. The subform on the second page of the Tab control displays only historic personnel action records. The frmPersonnelActionsEntry form has fields from the Personnel Actions table on both the main form and the subform, and it uses the qryPersonnelActions form you created at the beginning of this chapter as the form's data source. If you were creating a full-scale human resources database application, you might choose the Employees table as the data source for the form and design a subform for editing the Personnel Actions table. You might then put this subform on a third Tab control page or display the history in a subform of the subform.

Note

Creating a form and subform that are both based on the same underlying table—in this example, the Personnel Actions table—is a somewhat unconventional but totally acceptable database application design method. Most forms that employ subforms employ a base table (such as Employees) or a query whose data source is a base table as the record source of the main form. A related table or query based on a related table serves as the record source of the subform. Many of the forms of Northwind.mdb demonstrate the conventional form-subform design. Our form example, frmPersonnelActionsEntry, uses a common underlying table for both the form and subform to illustrate some of the unique characteristics of this approach to one-to-many form design.


To complete the main form, follow these steps (refer to Figure 13.55 for field placement):

1.
Click the Design View button on the toolbar (if the frmPersonnelActionsEntry form isn't already in Design view).

2.
If necessary, click the Toolbox button to enable the Control Wizards (make sure the button has a sunken appearance), and then click the Field List button on the toolbar to open the Field List dialog if it isn't already open.

3.
Drag the LastName field from the Field List to a position to the right of the ID field text box; when you release the mouse, Access creates a text box for the field. Edit the field's label to read Name:.

4.
Drag the FirstName field from the Field List to a position to the right of the LastName field; delete the FirstName field's label.

5.
Drag the paType field from the Field List to a position at the right of the FirstName field.

6.
Repeat step 5 for the paScheduledDate, paEffectiveDate, and paAmount fields (refer to Figure 13.55 for field positioning and sizing). You'll need to move the Approved By, Rating, and Zoom To fields that you placed on the form earlier in this chapter.

7.
Resize the paComments field so that it is underneath the paID and name fields (see Figure 13.55). Next, resize the Tab control so that it fills the width of the form and extends from an area below the paComments field to the bottom of the form. The Tab control needs to be as large as possible in order to display the most data in the subform that you'll later add to its second page.

8.
Click the first tab of the Tab control to bring it to the front, and then drag the Title field from the Field List to a position near the top left corner of the Company Info page.

9.
Repeat step 8 for the ReportsTo, Extension, and HireDate fields (refer to Figure 13.55 for field placement).

10.
Drag the Photo field onto the right side of the Tab control's first page and delete its label (the fact that this field displays a photo of the employee is enough to identify the field). Size and position the Photo field at the right edge of the Tab control's page; you may need to resize the Tab control and the form after inserting the Photo field.

11.
Double-click the Photo field to display its Properties window, click the Format tab, and select the Size Mode property's text box (see Figure 13.56). Select Zoom from the drop-down list to have the employee photo scaled down to fit the photo field's size.

Tip

Use the Format Painter to format the text labels of the fields. Using the Format Painter is described in Chapter 12, "Creating and Using Forms."

12.
Drag the Notes field onto the bottom left side of the Tab control's first page and delete its label. Refer to Figure 13.55 for placement and sizing.

13.
Use the techniques you learned in Chapter 12 to move, rearrange, and change the label formats to match the appearance of Figure 13.55. (All labels are bold and right-aligned.)

14.
Test your new fields by clicking the Form View button on the toolbar. Your form appears as shown in Figure 13.57.

Note

In Figure 13.55, all of the toolbars and the Form Design window's rulers have been turned off so that you can see the entire form in Design view.

Figure 13.55. The frmPersonnelActionsEntry form in Design view, showing the final placement and formatting of the main form fields and the first page of the tab control.


Figure 13.56. Setting the Photo field's Size Mode property so that photos are scaled to fit the size of the field on the form.


Figure 13.57. The frmPersonnelActionsEntry form of Figure 13.55 displayed in Form view.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.169.94