How to add records to a subform and main form "at the same time."

  • Thread starter \Daryl Mhoon via AccessMonster.com\
  • Start date
D

\Daryl Mhoon via AccessMonster.com\

I have two tables: tblPayments (parent) and tblPaymentMethod (child) linked
by a one to many relationship. tblPayments contains information specific to
the payment: date, pmntID, Notes (Balance due 7/15/05) etc. tblPayment
Method holds the info specific to the different payment methods: Amnount,
PmntMethod, Notes (third party check) etc. Likewise, I have two data entry
forms: frmPayments and subfrmPaymentMethod.

I would like to add a record via code to the mainform as soon as the user
starts typing amounts in the subform. I thought I could use the BeforeInsert
event on the subform to add a date to the mainform and it "kinda" works in
that the PmntID field in both forms gets populated but I still get the "you
can't add a record to the subform before the subform" error message from
Access.

I've tried a variety of events, a lot of different code and I've come close
but never quite figured it out.

In short: is possible via code to add a record to the main form, then the
subform when a user starts typing in the subform?

I'm not gonna tell you how long I've been fumbling with this...
 
Top