Trying to design a one to many data entry form/subform

  • Thread starter Thread starter Barrett Bonden
  • Start date Start date
B

Barrett Bonden

Trying to design a one to many data entry form/subform where the id number
in the second table (displayed in the subform) is automatically picked up
from the id number of the record in the main form.



Ideally the main table would be shown as a few text fields on the top of the
form, and then a subform would allow for the entry of an unlimited number of
associated records.



I've created both tables, and a query linking them, then created a subform
using that query. Nothing much happens in terms of the linked field in the
subform picking up the id number from the primary field.
 
The foreign key in the subform should pick up the primary key value in the
main form if you have the LinkMasterFields/LinkChildFields set up correctly.

Open the main form in design view.
Right-click the edge of the subform control, and choose Properties.
Make sure the LinkMasterFields contains the name of the main form's primary
key, and the LinkChildFields the name of the related field in the subform.

(While you are there, you might like to make sure that the field named in
LinkChildFields has a text box of with the same name in the subform. This
can help prevent a bug where Access 2002 and 2003 crash (shut down by
Windows) if LInkChildFields refers to an AccessField-type object instead of
a Control-type object.)
 
If you define the relationships in the relationships window and use the
wizard when you insert the subform, this should happen automatically.

HTH;

Amy
 
Back
Top