Check for duplicate rows in 2 columns before update

Posted by user3891378 on Stack Overflow See other posts from Stack Overflow or by user3891378
Published on 2014-08-22T16:05:16Z Indexed on 2014/08/22 16:20 UTC
Read the original article Hit count: 142

Filed under:
|
|

I have a table with 4 columns, and I need to check to see if a Column Pair exists before inserting a row into the database:

INSERT INTO dbo.tblCallReport_Detail (fkCallReport, fkProductCategory, Discussion, Action) VALUES (?, ?, ?, ?)

The pair in question is fkCallReport and fkProductCategory.

For example if the row trying to be inserted has fkCallReport = 3 and fkProductCategory = 5, and the database already has both of those values together, it should display an error and ask if they would like to combine the Disuccsion and Action with the current record.

Keep in mind I'm doing this in VBA Access 2010 and am still very new.

© Stack Overflow or respective owner

Related posts about sql

Related posts about vba