Macellaria
Macellaria

Reputation: 71

Access 2013: Trying to get a SubForm to refresh after Name is chosen in Main Form

I have a Main Form with a Subform within it. The Main Form [Test] is just a drop down of names. I want the Subform to pull up the addresses associated with the name that is chosen. I have tried the following:

On the Drop Down on "After Update"

Me.Address_DatasheetSub1.Form.Refresh
Me.Address_DatasheetSub1.Form.Requery
Forms![Test].[Address_DatasheetSub1].Form.Refresh
Forms![Test].[Address_DatasheetSub1].Form.Requery

I have also tried on separate button "On Click"

Me.Address_DatasheetSub1.Form.Refresh
Me.Address_DatasheetSub1.Form.Requery
Forms![Test].[Address_DatasheetSub1].Form.Refresh
Forms![Test].[Address_DatasheetSub1].Form.Requery

Nothing seems to work. However if I am on the Form View and press the "Refresh All" button on the Access ribbon, it works.

Upvotes: 0

Views: 58

Answers (1)

Gustav
Gustav

Reputation: 55806

Yes, use the LinkMasterFields and LinkChildFields properties of the subform control.

  • Set LinkMasterFields to: NameOfYourCombobox
  • Set LinkChildFields to: NameOfTheFieldYouFilterOn

and remove all code regarding the requery.

Upvotes: 1

Related Questions