Linking two subforms together.

F

Frank Martin

I have a FormMain and two subforms on this
Sub1 & Sub2.

Sub1 and Sub2 each contain the same field in
their records.

When I go to a record in Sub1, I want the
record with the same field in Sub2 to be
selected.

I need something simple such as:
LinkChildFields
LinkMasterFields
which works for a Main/Subform combination.

Or even a Combo on Sub1 to select a record on
Sub2.


Please help, Frank
 
W

Wolfgang Kais

Hello Frank.

Frank said:
I have a FormMain and two subforms on this Sub1 & Sub2.

Sub1 and Sub2 each contain the same field in their records.

When I go to a record in Sub1, I want the record with the
same field in Sub2 to be selected.

I need something simple such as:
LinkChildFields
LinkMasterFields
which works for a Main/Subform combination.

Or even a Combo on Sub1 to select a record on Sub2.

Crteate a textbox ("txtTheField") in the main form (it may be
invisible) and set its control source property to:
=[Sub1].Form![TheField]
Set the properties of the Sub2 subform control as follows:
LinkChildFields: TheField
LinkMasterFields txtTheField.Value
 
F

Frank Martin

message
Hello Frank.

Frank said:
I have a FormMain and two subforms on this
Sub1 & Sub2.

Sub1 and Sub2 each contain the same field
in their records.

When I go to a record in Sub1, I want the
record with the
same field in Sub2 to be selected.

I need something simple such as:
LinkChildFields
LinkMasterFields
which works for a Main/Subform
combination.

Or even a Combo on Sub1 to select a record
on Sub2.

Crteate a textbox ("txtTheField") in the
main form (it may be
invisible) and set its control source
property to:
=[Sub1].Form![TheField]
Set the properties of the Sub2 subform
control as follows:
LinkChildFields: TheField
LinkMasterFields txtTheField.Value

Thank you Wolfgang, I tried this but the
textbox ("txtTheField") will not appear in
the subforms' properties, and when I do it
manually I get blank forms.
Regards Frank
 
W

Wolfgang Kais

Hello Frank.

Frank said:
I have a FormMain and two subforms on this Sub1 & Sub2.
Sub1 and Sub2 each contain the same field in their records.
When I go to a record in Sub1, I want the record with the same
field in Sub2 to be selected. I need something simple such as:
LinkChildFields
LinkMasterFields
which works for a Main/Subform combination.

Or even a Combo on Sub1 to select a record on Sub2.
Create a textbox ("txtTheField") in the main form (it may be
invisible) and set its control source property to:
=[Sub1].Form![TheField]
Set the properties of the Sub2 subform control as follows:
LinkChildFields: TheField
LinkMasterFields: txtTheField.Value
Thank you Wolfgang, I tried this but the textbox ("txtTheField")
will not appear in the subforms' properties, and when I do it
manually I get blank forms.

If you try to use the wizard ("..."), he won't help you. YOu have to
enter the values yourself.
The Name "TheField" should be replaced by the name of the field that
appears in both subforms record source.
In my advice, i did not talk about Sub1 and how it should be linked.
I guess that you have done that already. So if both subforms are
blank, this means that either Sub1 isn't linked to the main form
correctly or even more simple: there is no data to be displayed.
If the first subform is displayed correctly, you also could try
to omit the .Value property of the textbox:
LinkMasterFields: txtTheField
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top