How to insert new data in two related tables

nector

Member
Local time
Today, 15:32
Joined
Jan 21, 2020
Messages
462
Hi All

Happy Xmas

Is it possible to use insert query to insert new data into two related tables , the parent and child table in Ms Access.
see the selected data below going into the same tables. The idea here is to create an automatic reversal for any wrong Financial Journal :


Code:
SELECT tblJournalHeader.CreateID, tblJournalHeader.DateCreated, tblJournalHeader.Journaltype, tblVoucher.Dr, tblVoucher.Cr, tblVoucher.Descriptions, tblVoucher.FCRate
FROM tblJournalHeader INNER JOIN tblVoucher ON tblJournalHeader.CreateID = tblVoucher.CreateID;
 
you need 2 insert query.
one for the journal, the other to voucher.
 
AND the two queries need to be run inside a transaction to ensure that they both succeed or they both get backed out.
 

Users who are viewing this thread

Back
Top Bottom