Microsoft Office Tutorials and References
In Depth Information
Using a Subform to Display Detail Records
the fields to
Don’t include the primary key, which relates to the record in the main
form. If you’re adding an order-details subform to an order form, the
main form displays one order at a time, including its order number. The
subform displays all the order-details records that have the same order
number. If you include the order number on the subform, you just see
the same order number over and over — once for each record in the
subform. What a waste of screen space!
8. Select a relationship in the list, or choose the Define My Own
option and select the matching fields on the form and subform; then
The wizard needs to know how the records in the subform relate to the
records in the main form. It displays a list of the relationships you’ve
already defined, and this list usually contains the right relationship. In
Figure 4-6, the wizard suggests Show Order Details for Each Record in
Orders Using OrderID — that is, it uses the OrderID field in the Order
Details table to match the OrderID field in the Orders table (the record
source of the main form).
If you choose the Define My Own option, the wizard’s window changes
to allow you to choose the matching fields of the form (the “one” side of
the relationship) and the subform (the “many” side).
9. Type a name for the subform or accept the wizard’s suggestion; then
The wizard creates the subform as a separate form in your database. It
also creates a subform control on the main form, as shown in Figure 4-7.
You can adjust the edges of the subform control by dragging them. You
can delete the label for the subform if its function is obvious.