Request for help - Creation of Foreign Key for subform

gellerche

Registered User.
Local time
Today, 17:20
Joined
Jun 19, 2001
Messages
73
This is probably a very simple question. I have a parent table and a child table. The parent table has a form, and the child table has a subform within the parent's form. The parent's PK is an autonumber. The child table has a field for the Foreign Key as a number. What I would like is when the user enters data in a row of the subform, the FK in the child table is automatically set to the parent's PK. The subform is used in more than one form, so I would like to avoid hard coding anything in the subform, if possible.

If someone could help me, I would appreciate it.

Thank you,


Steve Geller
 
If you use a form with a subform in the standard way, you should set the Link Child and Link Master Fields to be the PK of the main table and the foreign key of the child table, respectively. That will take care of the PKs and FKs for you.
 
Thanks, dcx. That did the trick. Actually, the child and master were already linked, but I deleted the subform instance on the form, and then recreated and relinked it, and for some reason it works now.

Thanks,

Steve Geller
 

Users who are viewing this thread

Back
Top Bottom