Forum Discussion
Link Master and Child
Hello Experts,
I have an unbound form frmFXTracker
On this unbound form I have a subform: frmFXParent
In the footer of frmFXTracker i have a subform: subfrmFXRollsChild
I am trying to link the Master and Child setting of subfrmFXRollsChild (pic below).
I am having an issue linking the Master field that is on the frmFXParent.
If I click on the ellipsis it says "cant create a link between unbound forms"
I am thinking I need to reference the name of the unbound form frmFXTracker and frmFXParent.txtIDFXParent but I think I am missing something since it doesnt work (system crashes). I have also tried without any reference to the form name but that doesnt work either. I assume my problem is in the pic below (yellow shaded)
I think the child is OK. The problem seems to be the Master field.
How do I link the Master to the field name txtIDFXParent?
subfrmFXRollsChild (the form in the footer of the unbound form frmFXTracker):
thank you.
Let me know if there are any questions.
=[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]
6 Replies
- George_HepworthSilver Contributor
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.
- Mark24Copper 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!
- Tony2021Iron 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_HepworthSilver 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]