Share via

Subform Refresh on Data Change

Anonymous
2015-12-04T14:56:04+00:00

I am using Access 2010, and hope to be porting things to SharePoint later, when we have something that works.

Currently I have a master form with two sub forms. One is a detailed form based on a table that allows selection of options through check boxes. The other is based on a query of the same table which calculates the desired information about total resources involved. If you think there is a better setup for this I am willing to listen.

Anyway, when I change data in the detailed form, I would like to see the changes in the summary form. I can achieve this if I click on the summary form and press F5.

I have tried producing a macro attached to the check box of the detail form which:

  • Refreshes the record. (RefreshRecord) I verified that the record is changed in the table as soon as the checkbox is clicked. The default in Access is to change the table only when you move to a new record.
  • Uses the GoToControl to go to the control name of the summary form. (I verified that the summary form is active and F5 updates it without my having to click on it.
  • RunMenuCommand Refresh. (This has no effect.)
  • RepaintObject with no parameters so it refers to the current object. (No effect.)
  • SendKeys {F5}. (No effect)
  • Wait, I just tried Requery with no parameters so it refers to the current control, and it seems to work. I had tried it without going to the control first, and it wouldn't recognize that control when I ran it.

Still, someone else might benefit from my discovery, so perhaps I should post this as a discussion. Are their better ways to do this?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-12-04T16:41:41+00:00

    Use the After Update event of the main forom to requery the subform:

    Me.Subformname.Form.Requery

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments