Link a main form and a subform
If you create a subform with the Form Wizard or the Subform Wizard, Microsoft Access automatically links the main form with the subform under certain conditions. For more information, click . If your main form and subform don't meet these conditions, you can use this procedure to link them.
- Open the main form in Design view.
- Make sure the subform control is selected, and then click Properties on the toolbar to display the property sheet for the subform control.
- Type the linking fields or controls in the LinkChildFields and LinkMasterFields properties. To enter more than one linking field or control, separate the field or control names with a semicolon. If you enter more than one field or control name, you must enter the names in the same order in both properties.
- Switch to Form view to test the link.
Notes
- The linking fields don't have to appear in the main form or the subform, but they must be included in the underlying record source. If you use the Form Wizard to create the subform, Microsoft Access automatically includes the linking fields in the underlying record source even if you don't pick them in the wizard.
- The linking fields must contain the same kind of data and have the same or a compatible data type or field size. For example, an AutoNumber field with its FieldSize property set to Long Integer is compatible with a Number field with its FieldSize property set to Long Integer.
- Make sure that the LinkChildFields property is set to the name of a field (as specified in the ControlSource property), not the name of a control (as specified in the Name property). The LinkMasterFields property can be set to the name of either a field or a control.
- For information on troubleshooting subforms, click .