Vaderman
November 19th, 2004, 04:08 AM
I have setup a database in MS Access 2K that has several tables. There are several relationships that exists between tables. My question is this: If I insert a row of data in one table that stores foreign keys from other tables, how can I ensure that all tables concerned are updated using INSERT?
For example, I have the main table :
PK - Quote_id
FK - Customer_ID
Project_Name
and the Customer table :
PK - Customer_ID
Customer_Name
this is a 1:M relationship.
Using a C# Form, I enter the data for Customer Name and the Project Name. Using the INSERT, how can I populate, not only the main table, but the Customer table too?
At the moment I'm having to get the customer name and inserting that data into the Customer table then once the data has been inserted I get the new Customer_ID, using a SELECT. once I have the new Customer_ID, I then use that as part of my INSERT statement to populate the main table.
Surely there must be a more effecient way to updating multiple tables that share a relationship?
Regards
John
For example, I have the main table :
PK - Quote_id
FK - Customer_ID
Project_Name
and the Customer table :
PK - Customer_ID
Customer_Name
this is a 1:M relationship.
Using a C# Form, I enter the data for Customer Name and the Project Name. Using the INSERT, how can I populate, not only the main table, but the Customer table too?
At the moment I'm having to get the customer name and inserting that data into the Customer table then once the data has been inserted I get the new Customer_ID, using a SELECT. once I have the new Customer_ID, I then use that as part of my INSERT statement to populate the main table.
Surely there must be a more effecient way to updating multiple tables that share a relationship?
Regards
John