• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 596
  • Last Modified:

Help with trigger in MS Access ADP Project

I have created the following trigger. However I would like both of the fields inserted into the same record. The way I have created this trigger, it is inserting each of my fields into a new record, not both fields into the same record.

CREATE TRIGGER CreateRecordInRADiag ON [dbo].[RAItemsDetail]

AFTER INSERT
AS
BEGIN
INSERT INTO RADiag (RADiag_RAItemsDetailID)
   SELECT RAItemsID FROM INSERTED;
INSERT INTO RADiag (RADiagRANumber)
   SELECT RAItemsRAnumber FROM INSERTED;
END
0
porkerjoe
Asked:
porkerjoe
1 Solution
 
MikeTooleCommented:
Replace the two insert statement with one:

INSERT INTO RADiag (RADiag_RAItemsDetailID, RADiagRANumber)
   SELECT RAItemsID, RAItemsRAnumber  FROM INSERTED;
0
 
porkerjoeAuthor Commented:
Worked perfectly! Thanks.
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now