Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    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]).

    thanks in advance.

  2. #2
    Join Date
    Apr 2002
    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);"
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts