There are no special procedures needed to design the main form in a mainform or subform relationship. To create a subform, you add a subform control. The subform control establishes the link between the main form and the subform, but it is not itself a form. You can, however, display any form in the subform control. If you are going to use an existing form as the subform, follow the procedure described here. If you are going to create a new form to use as the subform, it may be more convenient to create the subform first. For more information, see Subform Design.

Designing the Main Form

To design the main form in a main form and subform relationship

  1. Open the existing form in the Form Designer.

  2. Open the Toolbox, and select the Subform tool.

  3. Click the Subform button, and then click the design area to create the subform control.

  4. Open the Properties window (SHIFT+F4) of the subform control.

  5. In the SubFormID property field, enter the name of the form that the subform is based on (or use the lookup button to select the form from a list).

  6. In the SubFormLink property, enter the expression that links the two tables, for example the field that is common for the tables. There is an assist-edit function available to help you. Click the AssistButton to open the assist-edit window. Select the field name from the many side of the relationship (the subform table). Then select FIELD as the Type of the relationship. Finally, for the Value, select the field from the one side of the relationship (the main form table).

    NoteNote

    In the SubFormLink property, you can also select other types of links. If you choose CONST, Value must be a constant expression that selects records where the Field matches this expression. If you choose FILTER, Value must be a filter expression, for example, 10|30..40.

  7. In the SubFormView property, you can specify the key, sort order, and table filter to apply to the table when it is displayed in the subform. (You do not have to enter anything in this property.)

See Also

Concepts

Subform Design