PurpleUnicorn
Programmer
I have an Access database(F/E and B/E) that I am in the process of migrating to SQL Server. I currently have sample data in SQL Server and I am testing my Access F/E.
I have a delete trigger that is firing correctly - however, I am not getting the error message from my Access F/E.
Here is my trigger:
ALTER Trigger [CUSTOMERdelete] on [dbo].[CUSTOMER]
for delete
as
BEGIN
declare
@errorNumber int,
@errorMsg varchar(255)
if exists(
select * from deleted, ORDERS where ORDERS.CUSTOMER_ID = deleted.CUSTOMER_ID)
begin
select @errorNumber = 30004,
@errorMsg = 'Cannot delete from CUSTOMER because ORDERS exists.'
goto errorHandler
end
return
errorHandler:
raiserror @errorNumber @errorMsg
rollback transaction
END
GO
I have also tried creating Foreign Key constraint (and dropping the trigger) - still no error message in my front end.
If there are child records - the parent does not get deleted, but no error message is displayed.