Forum Discussion
Link Master and Child
- Apr 23, 2022
=[Forms]![frmFXTracker].[frmFXParent].[Form].[txtIDFXParent]
seems close, but I think, in the control source property of the hidden form, though, it should probably be:
=[frmFXParent].[Form]![txtIDFXParent]
You have a main form that is not bound to a recordsource.
You have two separate subforms, each bound to a separate recordsource.
You want to coordinate records in the two subforms, based on the value in a field called "txtIDFXParent", which is NOT on the main form, rather it is on one of the the two subforms.
This won't work.
Both subforms must be linked to the main form, or rather to a control on the main form.
Place a hidden control on the main form and populate it with the value you need, i.e. whatever field the control called "txtIDFXParent" is bound to in the subform.
Now, you can use that new, hidden control, to link the second subform's master/child linking.
- Mark24Mar 30, 2025Copper Contributor
George,
Outstanding answer. I have a main form with subformA and subformB. SubformA is a summary of account names and numbers. SubformB is details of transactions for any vendor selected in subformA.
Following your advice, I created a text box on the main form and referenced the value of the account number in subformA. Then in the data tab of subformB I linked the master field to the new text box, and linked the child field to the account number in subformB.
Thank You!
- Tony2021Apr 23, 2022Iron Contributor
Hi George,
I think I understand conceptually. How do I set the value in the hidden field? I thought maybe by =[Forms]![frmFXTracker].[frmFXParent].[Form].[txtIDFXParent] (or something like that) but I dont think that is the solution. I need to set that hidden field to the value that is found in frmFXParent.txtIDFXParent.
Maybe using the On Current Event of the unbound form?
I tried it but doesnt work. Get an error of "invalid reference to the parent property":
Private Sub Form_Current()
Me.Parent.txtIDLink = Me.Parent.txtIDFXParent
End SubMe.Parent.txtIDLink = the hidden field
thank you for the help!- George_HepworthApr 23, 2022Silver Contributor
=[Forms]![frmFXTracker].[frmFXParent].[Form].[txtIDFXParent]
seems close, but I think, in the control source property of the hidden form, though, it should probably be:
=[frmFXParent].[Form]![txtIDFXParent]
- Tony2021Apr 23, 2022Iron ContributorPerfect! thank you very much. It works great!