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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Audit Trail Trigger DELETE conflict

Status
Not open for further replies.

Baesucks

Programmer
Mar 10, 2008
37
0
0
US
I have been using audit trail triggers on all my SQL Server tables for some time. It records all Insert, Update, and Delete events to an audit trail table (one record for each field).

I have a continuous form who's data source is a table. When I just highlight the row in the continuous form and tell it to delete the record I get an error message "Another user or application has deleted this record or changed the value of its primary key".

The good news is... really the record gets deleted from the table (as expected). The bad news is the continuous form doesn't update to indicate the record is gone, and the user is going to wonder what the error message is all about.

A little research indicated the problem was due to a trigger being on the table and sure enough if I remove the trigger the problem goes away, but then so does the auditing feature. With the trigger in place, if I delete a record using SQL Server admin tools I don't get any error message (so the trigger itself works).

For the record, there are no cascading deletes taking place in the trigger. Its just a one table deal. Its almost as if halfway through running the trigger the record is gone.

Also of note, the error is not related to the form - because if I just view the table in datasheet mode (in MS-Access 2007), and choose to delete the record there the same process happens (error message, but the record gets deleted).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top