Hello,
I had a user call me saying that her off-the-shelf access app is broken.
Basically, there is a trigger that checks on several relationships before deleting a contact record so as to not strand orphan records. Ok, cool... but? The below code in the delete trigger ends up with the below message (shown in the image), and is not exactly elegant.
How would I get the error message to show what is written in the trigger? I've never tried this before... so forgive my newbieness
Thoughts? Tips? Pushes in the right direct?
Thanks!
-Matt G.
I had a user call me saying that her off-the-shelf access app is broken.
Basically, there is a trigger that checks on several relationships before deleting a contact record so as to not strand orphan records. Ok, cool... but? The below code in the delete trigger ends up with the below message (shown in the image), and is not exactly elegant.
Code:
/* * PREVENT DELETES IF DEPENDENT RECORDS IN 'tblCommitteeMembership' */
IF (SELECT COUNT(*) FROM deleted, tblCommitteeMembership WHERE (deleted."Person ID" = tblCommitteeMembership."Person ID")) > 0
BEGIN
RAISERROR 44445 'The record can''t be deleted or changed. Since related records exist in table ''tblCommitteeMembership'', referential integrity rules would be violated.'
ROLLBACK TRANSACTION
END
Thoughts? Tips? Pushes in the right direct?
Thanks!
-Matt G.