Creating Multi-Table Forms

Team-Fly    

 
10 Minute Guide to Microsoft Access 2002
By Joe Habraken
Table of Contents
Lesson 21.  Taking Advantage of Database Relationships

Creating Multi-Table Forms

Forms can be created from more than one table using the Form Wizard or the Form Design view. Creating a form from fields that reside in more than one table allows you to enter data into more than one table using just the single form.

A very simple way to create a multi-table form is to add a subform to an existing form. For example, you might have a form that is based on a Customers table. If you would also like to be able to view and enter order information when you work with the Customers form, you can add an Orders subform to it. It is important that the tables used to create the two forms (the main form and the subform) are related tables.

Plain English

Subform A form control that actually consists of an entire form based on another table or tables.


The easiest way to reate a subform is to actually drag an existing form onto another form in the Design view. The following steps describe how you do it:

  1. Use the AutoForm feature, the Form Wizard, or the Form Design view to create two forms: the form that serves as the main form and the form that serves as the subform. These forms should be based on tables that are related.

  2. In the Form Design view, open the form that will serve as the main form.

  3. Size the Form Design window so that you can also see the database window in the Access workspace (see Figure 21.6).

  4. In the database window, be sure that the Forms list is showing. Then, drag the form that will serve as the subform onto the main form that is open in the Design view. When the mouse pointer enters the Design view, it becomes a control pointer. Release the mouse button when you are in the general area where you want to place the subform. The subform control appears on the main form.

  5. Maximize the Form Design window. Reposition or size the subform in the Design view until you are happy with its location (see Figure 21.7).

  6. Save the changes that you have made to the main form ( specifically , the addition of the subform).

  7. To change to the Form view to view or add data to the composite form, click the View button on the Form Design toolbar.

Figure 21.6. The subform is dragged from the database window onto the Design view of the main form.

Figure 21.7. The subform becomes another control on the main form.

Figure 21.8 shows the main form and the subform in the Form view. The form can be used to view or enter data into two tables at once.

Figure 21.8. The composite form can be used to view and enter data into more than one table.


Team-Fly    
Top
 


10 Minute Guide to Microsoft Access 2002
10 Minute Guide to Microsoft Access 2002
ISBN: 0789726319
EAN: 2147483647
Year: 2000
Pages: 160
Authors: Joe Habraken

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net