Setting subform links to another subform record

D

Dennis Snelgrove

I've got a form with two subforms on it. The main form and subform1
combined define the record(s) that subform2 will display and add to.
Main and sub1 both have a single primary key field each. How do I set
up the link in sub2 to reference properly?

Thanks for any insights...
 
M

Marshall Barton

Dennis said:
I've got a form with two subforms on it. The main form and subform1
combined define the record(s) that subform2 will display and add to.
Main and sub1 both have a single primary key field each. How do I set
up the link in sub2 to reference properly?


Add a hidden text box (name it txtSubID to the header/footer
section of sub1. Add a line of code to sub1's Current event
procedure:
Parent.txtSubPK = me.txtPKfield

Then, assuming sub2 has a compound primary key (or at least
a Unique index), the sub2 Link Master property would be:
txtmainPK, txtSubID
 

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