saving in two tables

if i have two tables(tblClient, tblAnswer) connected through a certain "ClientID" in my form. how do i code that the data that is input in my form will be save in both tables. i already know how to save on the first table(tblClient) which is plain INSERT statement. but i don't know how on saving in the second table on which the "ClientID"(PK-autonumber) on my tblClient will be save in my tblAnswer along with the other data. by the way, the first and second table have different data fields. the first one is on personal info on the client.


  • The same code will be used to INSERT RECORD in the second table. just change whatever the field_name of that second table. after the INSERT_RECORD code in the 1st table, add a code that will close the 1st table (note: do not close the database connection). then add a code again to open the second table then the code to insert record in the second table.

    Here is the algorithm:
    - use error anticipating function (optional)
    - connect to database (open database connection)
    - open 1st table
    - check if record already exist (optional)
    - insert record in 1st table
    - close 1st table (database still connected)
    - open 2nd table
    - check if record already exist (optional)
    - insert record in 2nd table
    - inform user if insert record successful (message box)
    - close 2nd table
    - close database connection

  • isn't that over complicated? all i want to know is how to insert the last id encoded
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!