How to show related values in i subform. (1 Viewer)

Klingest

Registered User.
Local time
Today, 10:36
Joined
Aug 11, 2017
Messages
11
Hello people

I have a form with two subforms within it.

The first subform displays a table named "tblCalculation", the second subform displays table named "tblSubCalculation".

The two tables are related in a one to many relationship as follows:

"tblCalculation" [ one -> many ] "tblSubCalculation"

What I want to do is, that when you select a record in the subform showing "tblCalculation", the related values from "tblSubCalculation" shall be displayed in the other subform.

How can I do that?
 

isladogs

CID VIP
Local time
Today, 09:36
Joined
Jan 14, 2017
Messages
16,062
Depends on how you have the form & 2 subforms setup.
You haven't mentioned the main form - what is its datasource ... or is it just a container for the 2 subforms.

Is there a parent child relationship set up between the form & each subform
OR is there a parent child relationship set up between the 2 subforms

Whichever of the above is true, which fields link the two forms?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:36
Joined
May 7, 2009
Messages
16,086
Add an Unbound Textbox to Main form.
say (txtSub1PK).
on the second subform, goto Property->Data
Link Master Fields: txtSub1PK
Link Child Fields: <Foreign Key of subform2>


On Current Event of Subform1, set the value of unbound textbox to its Primary Key:


Private Sub Form_Current()
Me.Parent!txtSub1PK = Me.<PK key>
End Sub




***
this will show related records of subform1 in subform2.
 

Users who are viewing this thread

Top Bottom