Synchronize records between two forms programmatically

Microsoft Office Access 2003

  1. To create a macro, click Macros Button image under Objects, and then click the New button on the Database window toolbar.
  2. In a blank action row, click OpenForm in the action list.
  3. 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.
  4. Click Save Button image and close the macro window.
  5. Open the first form in Design view and set the OnCurrent event property of the form to the name of the macro.
  6. 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.

ShowUse Microsoft Visual Basic code

  1. Open the first form in Design view.
  2. 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.
  3. Click the OnCurrent event.

  4. Click Build Button image next to the property box to display the Choose Builder dialog box.
  5. Double-click Code Builder to display the event procedure window.
  6. 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.
  7. 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.

ShowTip

You can also use the Form Wizard to create two related forms from scratch by using the Linked Forms option.