- To create a macro, click Macros under Objects, and then click the New button on the Database window toolbar.
- In a blank action row, click OpenForm in the action list.
- Set the Form Name argument to the name of the second form, and then set the Where Condition argument to display the related records you want in the second form.
- Click Save and close the macro window.
- Open the first form in Design view and set the OnCurrent event property of the form to the name of the macro.
- To test, open the first form in Form view and move from one record to another record.
The second form should open and display related records.
Use Microsoft Visual Basic code
- Open the first form in Design view.
- To open the form's Form_Current event procedure for the appropriate event, display the property sheet for the form, and then click the Event tab.
-
Click the OnCurrent event.
- Click Build next to the property box to display the Choose Builder dialog box.
- Double-click Code Builder to display the event procedure window.
- Add Visual Basic code to the event procedure to display records in the second form that have field values that match a related field on the first form.
- To test, open the first form in Form view and move from one record to another record.
The second form should open and display related records.
You can also use the Form Wizard to create two related forms from scratch by using the Linked Forms option.