- Understanding Access's Approach to Application Design
- Creating an Access Application from a Template File
- Touring the Contact Management Application
- Using the Switchboard Manager
- Exploring Form Design View and VBA Class Modules
- Downloading Templates from the Microsoft Office Update Site
- Saving a Form As a Data Access Page
- In the Real World--Putting What You've Learned in Perspective
Exploring Form Design View and VBA Class Modules
Designing forms and writing VBA code are advanced Access topics, but you can preview the topics covered by later chapters by following these steps:
With the Main Switchboard active, click the Design view button at the extreme
left of the toolbar to open the Main Switchboard in Design view (see Figure
3.33). The Toolbox, which you use to add controls (text boxes, buttons,
and the like) to forms, appears to the left of the Form Design window. If
the Toolbox isn't open, click the Toolbox button on the Form Design toolbar.
Figure 3.33 Open the Switchboard form in Design view.
Press Ctrl+R to select the entire form and then click the toolbar's Properties button to open the Properties window. By default, the Properties window displays all the properties of the selected object--in this case, the form.
Click the Data tab to display only the data-related properties of the form (see Figure 3.34). The most important property is the Record Source, which specifies the Switchboard Items table as the table bound to the form. The Filter property specifies that the form obtains its data from the first record of the Switchboard Items table.
Figure 3.34 The Data page of the Form properties sheet for the Switchboard form displays data-related property values.
Click to select the top button (under the C of Contact Management in the Design view of the form). The Properties window displays the properties of Command Button: Option1.
Click the Event tab to display the Event properties of Option1 (see Figure 3.35). The =HandleButtonClick(1) value of the On Click event executes the HandleButtonClick VBA function when you click the button.
Figure 3.35 The Event page displays a list of the events that Access forms can fire.
Click the Code button on the toolbar to display the Contacts - Form_Switchboard (Code) window of the VBA editor. Page down until you see Private Function HandleButtonClick(intBtn As Integer), as shown in Figure 3.36. The Option1 command button calls this function to handle the On Click event. The (1) suffix of the event value is passed to the function as the value of the intBtn argument. Scroll through the code until you reach the End Function statement, which terminates the HandleButtonClick function.
Close the VBA editor or press Alt+Tab to return to the Switchboard form, and then click the Form view button to return the Switchboard form to its original state. (You might also need to close the Properties window.)