Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple tables INSERT

Status
Not open for further replies.

medisa

Programmer
Nov 13, 2001
3
GB
dear all

can anyone help me with the following:

syntax for INSERT statement into multiple tables i.e. I am trying to insert rows(using Java and SQL with Access) into more then one table with one button click;

e.g. user fills in the form and clicks submit button - data from the form's fileds is then inserted into dB that contains 4 tables

thank you
 

In access you can append to or insert into one table at a time. You will need to create four Insert statements, one for each table. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 

thanks Terry
I think that my problem is due to me having one to many relationships between tables ... hence the primary key in one table is the foreign key in another - due to this I have problems with INSERT .... for example, after inserting data in one table I then have to copy the primary key from that table and insert into the second table which allows me to insert data into that table .... uuuhh, the joys of working life ..... would appreciate if you can let me know if this is the correct way of doing things or does Access have some db triggers that can insert/copy the primary keys into relevant tables as data is inserted into the table ... (sorry if this doesn't make much sense, but don't know how to explain it better) .... thanks medisa
 

The Jet engine in Access provides referential integrity checks and can handle cascaded deletes and updates. However, it doesn't do cascaded inserts for good reason. It doesn't make sense to do so. Inserts should be under program control. There are no triggers in Access so the way you are handling the inserts in code is appropriate. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top