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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking a subform (one to one relationship)

Status
Not open for further replies.

splats

Technical User
Jan 2, 2003
131
Hello

I have a subform that is based on a one to one relationship with the mainform. I would like the linking field (primary key of the subform)to automatically fill in to the corresponding record (primary Key of the Mainform) in the mainform when the subform is accessed for the first time. Is there a way to do this when the subform is based on a one to one relationship?

TIA
 
I'm not sure if I understand. Do you want the key field of the main form to be automatically populated? Or do you want the key field of the subform to be automatically updated?

lonniejohnson@prodev.us
ProDev, MS Access Applications B-) ,
May God bless you beyond your imagination.
 
I want the key field of the subform to be automatically updated (Based on the data from the Main form.)
 
If you have the "LINK CHILD FIELDS" and "LINK MASTER FIELDS" properties of the subform object set to the ID. It should automatically insert the ID from the main form in the ID of the new form for new records.

lonniejohnson@prodev.us
ProDev, MS Access Applications B-) ,
May God bless you beyond your imagination.
 
Hello Again

This is working however only for records that already match.. I would like it to create a new record that matches (automatically) if there is not one in the subform.

any ideas would be appreciated.

TIA
 
Hello everyone I figured it out

I used a query using a Left Outer Join to link the tables. It works exactly as I would like it to!

[2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top