Requerying subform from another subform (1 Viewer)

CedarTree

Registered User.
Local time
Today, 04:51
Joined
Mar 2, 2018
Messages
404
Hello all.
I have a MAIN form, and a subform listing documents (SF_DOCS) and another subform listing words on that document (SF_WORDS). When I click on a different record on SF_DOCS, I want the SF_WORDS to not just load up using master/child fields, but to go to the top of the datasheet (if you were on the a Doc record previously and on say the 10th row of words, and click on another Doc, the record selector will stay on 10th row in Datasheet, but I want it forced to move to 1st row)
Suggestions please? I've googled with no luck so far. Thanks!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:51
Joined
Feb 19, 2002
Messages
43,275
Here is a sample I built that shows one way to sync the forms. We have a main form that is bound to an audit. The left subform, shows a list of the members who are being audited. When you click on a member, the right subform shows the dependents for that member. When you click on a dependent, the bottom, right subform shows the details for a specific dependendent.
accSyncThreeSubforms.JPG
 

Attachments

  • MasterChildLinks_20230205.zip
    1.5 MB · Views: 79

CedarTree

Registered User.
Local time
Today, 04:51
Joined
Mar 2, 2018
Messages
404
It doesn't seem default. I tried setting up a public sub on the SF_WORDS that would would do a me.requery call, but can't seem to get syntax right to call a subroutine from one subform to another?
 

CedarTree

Registered User.
Local time
Today, 04:51
Joined
Mar 2, 2018
Messages
404
Never mind - I got the sub to run me.requery -- to call the sub from one subform to another, I used this: Forms!MainForm.OtherSubForm.Form.subRefreshForm
and subRefreshForm is a public sub that runs me.requery
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:51
Joined
Feb 19, 2002
Messages
43,275
Or, you can examine the example I posted where you will see how the master/child links are set as well as the code needed to sync the foreign keys.
 

Users who are viewing this thread

Top Bottom