linking two subforms

G

Gen

Hi there,

I am using Acess 03 and I don't know if this is possible. I have three
tables linked sequentially through one-to-many relationships. I'd like to
create a mainform with two subforms, 1 and 2. The mainform would display data
from table1, subform1 would be the related records in table2 for the record
in the mainform as a datasheet, and subform2 displaying the related records
in table 3 for the selected record in subform1. I had no trouble creating the
main form and subform1, the trouble is subform2. Does this make sense? is it
possible? Thanks for your help
 
A

Arvin Meyer [MVP]

There is an example in the Northwind sample database that came with your
version of Access.

One way to accomplish what you want is to set a hidden textbox on the main
form equal to the primary key on Subform 1. Then set the foreign key link on
Subform 2 equal to that textbox.

It should look like:

LinkMaster: [Forms]![MainFormName]![HiddenTextboxName]
LinkChild: [ForeignKeyName]

As new records in Subform 2 are created, they will pick up the proper
foreign key value.
 
G

Gen

thanks that was really simple and worked perfectly.

Arvin Meyer said:
There is an example in the Northwind sample database that came with your
version of Access.

One way to accomplish what you want is to set a hidden textbox on the main
form equal to the primary key on Subform 1. Then set the foreign key link on
Subform 2 equal to that textbox.

It should look like:

LinkMaster: [Forms]![MainFormName]![HiddenTextboxName]
LinkChild: [ForeignKeyName]

As new records in Subform 2 are created, they will pick up the proper
foreign key value.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Gen said:
Hi there,

I am using Acess 03 and I don't know if this is possible. I have three
tables linked sequentially through one-to-many relationships. I'd like to
create a mainform with two subforms, 1 and 2. The mainform would display
data
from table1, subform1 would be the related records in table2 for the
record
in the mainform as a datasheet, and subform2 displaying the related
records
in table 3 for the selected record in subform1. I had no trouble creating
the
main form and subform1, the trouble is subform2. Does this make sense? is
it
possible? Thanks for your help
 

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

Similar Threads


Top