Tom Zvolensky
Tom Zvolensky

Reputation: 73

Requery a form based on current record in another form

I have a form that has two subforms; AvailablePublicFolderUsersSubform and RelatedSharedMailboxSubform.

For the current record on AvailablePublicFolderUsersSubform, I want to requery form RelatedSharedMailboxSubform based on the value of column PrimarySmtpAddress in AvailablePublicFolderUsersSubform.

When I open the main form, I get the following error within form AvailablePublicFolderUsersSubform:

enter image description here

Any suggestions to make the proper RecordSource change and eliminate the error is much appreciated.

Thanks in advance.

Upvotes: 0

Views: 186

Answers (1)

Andre
Andre

Reputation: 27644

Since your code runs in another subform, AvailablePublicFolderUsersSubform, you need to "navigate" from there:

  • up (to the main form),
  • sideways (to the other subform),
  • down (form + properties of subform)

which translates to

Me.Parent.RelatedSharedMailboxSubform.Form.RecordSource

Note: after setting .RecordSource you don't need .Requery, this is done automatically.

Upvotes: 1

Related Questions