Microsoft Office Tutorials and References
In Depth Information
Elsa would like you to create a form so that she can view the data for each employer and
its available positions at the same time. The type of form you need to create will include a
main form and a subform.
Creating a Form with a Main Form and a Subform
To create a form based on two tables, you must first define a relationship between the two
tables. In Tutorial 3, you defined a one-to-many relationship between the Employer (primary)
and Position (related) tables, so you are ready to create the form based on both tables.
When you create a form containing data from two tables that have a one-to-many rela-
tionship, you actually create a main form for data from the primary table and a subform
for data from the related table. Access uses the defined relationship between the tables to
join them automatically through the common field that exists in both tables.
Elsa and her staff will use the form when contacting employers about their available
positions. The main form will contain the employer ID and name, contact first and last
names, and phone number for each employer. The subform will contain the position ID
and title, wage, hours per week, experience, start and end dates, and number of openings
for each position.
You’ll use the Form Wizard to create the form.
For hands-on practice of
key tasks in this session,
go to the SAM 2003
Training Companion CD
included with this text.
To create the form using the Form Wizard:
1. If you took a break after the previous session, make sure that Access is running and the
Northeast database is open.
2. Make sure the Forms object is selected in the Database window, and then click the New
button. The New Form dialog box opens.
When creating a form based on two tables, you first choose the primary table and select
the fields you want to include in the main form; then you choose the related table and
select fields from it for the subform.
3. Click Form Wizard , click the list arrow for choosing a table or query, click Employer to
select this table as the source for the main form, and then click the OK button. The first
Form Wizard dialog box opens, in which you select fields in the order you want them to
appear on the main form.
Elsa wants the form to include only the EmployerID, EmployerName, ContactFirstName,
ContactLastName, and Phone fields from the Employer table.
4. Click EmployerID in the Available Fields list box (if necessary), and then click the
button to move the field to the Selected Fields list box.
5. Repeat Step 4 for the EmployerName , ContactFirstName , ContactLastName , and
The EmployerID field will appear in the main form, so you do not have to include it in the
subform. Otherwise, Elsa wants the subform to include all the fields from the Position table.
6. Click the Tables/Queries list arrow, and then click Table: Position . The fields from the
Position table appear in the Available Fields list box. The quickest way to add the fields you
want to include is to move all the fields to the Selected Fields list box, and then to remove
the only field you don’t want to include (EmployerID).