at the corner of flotsam & jetsam, just within the walls of reality
Unanswered: new record populate multiple tables
hello, i have a question regarding auto-data entry, if there is such a thing.
i have a field called CustID, which is an autonumber and primary key in its original table (Customers) but a number and foreign key in (many) other tables.
when i add a new record to the Customers table, is there a way so that Access can automatically add this CustID to a new record in certain tables i choose? (so, for example, let's say i have 50 records in my Customers table, and i add record 51, i'd like Access to add a new record to table X [where there is a one to many relationshp between Customers and X]).
Unfortonately Access doesn't support triggers on table level. You can however emulate the same when you work with events on you forms. The AfterUpdate event would be the correct one to chose there then. A code to do this would look something like that:
Private Sub MyForm_AfterUpdate()
currentdb.execute "INSERT INTO X (CustID, more_fields) " & _
"VALUES (" & Me.CustID & ", more_values);"