Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I link one subform with another?

Status
Not open for further replies.

DaverD

Technical User
Jun 11, 2003
14
US
How do I link two Access subforms?

I understand how to link a form to a subform but I don't understand how I would link one subform to another. Both subforms have a common field that I can use to link the two.

The form has a baseball player's batting history. The main form has the batter's name and bio facts. The first subform has a datasheet view of that player's batting history by year. The second subform has one year's worth of the team's averages. The year I want displayed in the second subform is the year identified by the record selected in the first subform.

As an alternative, I am looking at placing one subform inside the other to get the form/subform relationship but I don't know if it will work visually.

Thanks in advance...
David
 
Have a look at NorthWind Database CustomerOrders form that has two subforms exactly what you are looking for

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
First, you need a to ensure you have a valid relationship - typically a one-to-many primary key / foreign key.

Open the form with the embedded subform in design mode. Make sure the Properties window is open (from the menu, "View" -> "Properties")

Select a control such as a text box on the main form, and then select the subform once.

Now click on the "Data" tab in the Properties window. Look at the two fields LinkChildFields and LinkMasterFields. The primary / foreign key should be displayed. If not, select the LinkChildField and then click on the "..." command button that appears to the right. This opens the "Subform field linker". Use the drop down box to select the key fields that are to be used to link the main form and subform.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top