Download presentation
Presentation is loading. Please wait.
1
Developing Forms and Subforms
2
Objectives Understand the form/subform relationship
Create subforms using the Form Wizard Create subforms using queries Modify subforms
3
Objectives Add combo boxes Add option groups Add command buttons
Add ActiveX controls
4
Introduction A form can be designed to present data in any logical screen arrangement. Serves as the primary interface for most database users Forms contain controls such as labels, text boxes, combo boxes, and command buttons to help identify and enter data. A form with a subform allows you to show a record and its relates records from another object (table or query) at the same time
5
Understanding the Form/Subform Relationship
A subform control is actually a form within a form. The primary form is called the main form, and it contains the subform control A subform shows related records that are linked to the single record currently displayed in the main form The relationship between the main form and the subform is often called a parent/child relationship
6
Understanding the Form/Subform Relationship (cont.)
The link between the main form and the subform is established through a linking field common to both Form/Subform planning guidelines. Sketch the layout, identifying which fields belong in the main form and which belong in the subform Determine whether you need to create separate queries upon which the main form and subform will be based
7
Understanding the Form/Subform Relationship (cont.)
Can use the Form Wizard to collect fields from multiple tables A recordset defines the fields and records that will appear on the form The Record Source property is where the recordset of forms are defined Create the form and subform objects based on appropriate intermediary queries
8
Understanding the Form/Subform Relationship (cont.)
Employees Main form with Attendance Subform
9
Understanding the Form/Subform Relationship (cont.)
Courses Main form with Employee Subform
10
Creating Subforms Using the Form Wizard
A form displays the fields of a table or query in an arrangement that you design. Based on five general layouts: Columnar, Tabular, Datasheet, Chart, and PivotTable Columnar is the most popular layout for a form and Datasheet is the most popular layout for a subform
11
Creating Subforms Using the Form Wizard (cont.)
Employee main form Attendance Subform
12
Creating Subforms Using the Form Wizard (cont.)
Attendance Subform is selected object Subform control
13
Creating Subforms Using the Form Wizard (cont.)
Form Wizard layouts
14
Creating Subforms Using Queries
Create a form with a subform separately by basing them on table or query objects, then linking them together in a form/subform relationship. The advantage of this method makes it easy to change the recordset of the form by modifying the underlying query
15
Creating Subforms Using Queries (cont.)
Form Selector button Drag fields here from field list Field list
16
Creating Subforms Using Queries (cont.)
Linking the form and subform. If the form and subform do not appear to correctly linked, look over the subform’s property sheet Check the Link child Fields and Link Master Fields properties on the Data tab carefully These properties tell you which field serves as the link between the main form and the subform
17
Modifying Subforms In Form View, you can resize, hide, or move subform columns as well as change the font, grid color, or background color. The controls of both the main form and subform can be modified when working in Design View of the main form
18
Modifying Subforms (cont.)
Double-click the right edge of the field name to resize the column
19
Modifying Subforms (cont.)
Default View property options for subforms
20
Adding Combo Boxes The List box and Combo box controls provide a list of values from which the user can choose an entry. A combo box allows the user to make an entry from the keyboard; therefore, it is a “combination” of the list box and text box controls
21
Adding Combo Boxes (cont.)
22
Adding Combo Boxes (cont.)
Choosing between a combo box and a list box. The list box and combo box controls are very similar The combo box allows the user to make a unique entry from the keyboard The combo box uses a drop down list to view value choices
23
Adding Option Groups An option group is a special type of bound control. Often used when a limited number of values are available for a field Place option button controls within the option group to determine the value that is placed in the field When a user click an option button, the numeric value associated with that option button is entered into the field bound to the option group
24
Adding Option Groups (cont.)
The Option Group Wizard helps guide the process of developing an option group The Control Source property of the option group identifies the field it will update The Option Value property of each option button identifies what value will be placed in the field when that option button is clicked
25
Adding Option Groups (cont.)
Option button
26
Adding Option Groups (cont.)
Protecting data. You can design forms to limit access to certain fields by changing the enabled and locked properties of a control The Enabled property specifies whether a control can have the focus in Form View The Locked property specifies whether you can edit data in a control in Form View
27
Adding Command Buttons
A command button is a powerful unbound control used to initiate a common action in Form View. Some common actions include printing the current record, opening another form, and closing the current form Often added to the form header or form footer sections Sections determine where controls appear and print
28
Adding Command Buttons (cont.)
Print Record command button in the Form Header
29
Adding Command Buttons (cont.)
Form Sections
30
Adding ActiveX Controls
An ActiveX control is a control that follows ActiveX standards. ActiveX Standards are programming standards that were developed by Microsoft ActiveX standards allow the sharing of software components and functionality across multiple applications
31
Adding ActiveX Controls (cont.)
Calendar control Spreadsheet control
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.