Trouble associating parent form record to subform's record

  • Thread starter Thread starter Marty McDonald
  • Start date Start date
M

Marty McDonald

I'll use make-believe table names to make things easier here. The
main form is bound to tblEngine. The subform is bound to tblPart.
But tblEngine has a foreign key to tblPart. While working on the main
form, I need to add a part (via the subform), then associate the
engine record to that part record. But even though I associate the
forms by the key & foreign key, the subform's record is inserted, but
not associated to the parent form record. I think it's because the
subform record is actually the parent. Using the subform "after
insert" event, I tried putting the new record's id into the main
form's foreign key field, but Access complained about the event source
not being available. Does anyone know how I can add the subform
record, then associate the main form record to it? Thanks
 
Marty said:
I'll use make-believe table names to make things easier here. The
main form is bound to tblEngine. The subform is bound to tblPart.
But tblEngine has a foreign key to tblPart. While working on the main
form, I need to add a part (via the subform), then associate the
engine record to that part record. But even though I associate the
forms by the key & foreign key, the subform's record is inserted, but
not associated to the parent form record. I think it's because the
subform record is actually the parent. Using the subform "after
insert" event, I tried putting the new record's id into the main
form's foreign key field, but Access complained about the event source
not being available. Does anyone know how I can add the subform
record, then associate the main form record to it? Thanks

Yeah, bound the parent table to the parent form and the child table to the
child form.

One engine has many parts right. To associate many records to one means
using the subform for the many side. This is not a place where "original
thinking" is your friend.
 
Back
Top