auto fill foreign key in subform

D

desertdirk

is there a way to have the foreign key in a subform take on the value of
the current primary key in the main form automatically? I know this can
be set using a combo box but I want it automatic
Thanks
 
G

Graham Mandeno

The usual way to set up a subform is to set the Link Master/Child Fields
parameters of the subform control.

Set LinkMasterFields to the name of a *control* on the main form which
contains the primary key (the ONE side of the relationship).

Set LinkChildFields to the name of the *field* in the subform's recordsource
which contains the foreign key (the MANY side). It does not need to be
bound to a control on the subform

Then, when you add a new record to the subform, the foreign key field will
be filled automatically from the control on the main form.
 
D

desertdirk

Many thanks. I didn't recieve an email telling me anybody had replied to
this message. I will have to check my profile options. Anyway thanky
out. I had set up subform and form but forgot the parent child fields
 

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