I set up a trigger on Friday, hoping to have a history table on my database. The trigger seemed to be working fine. Then, I started getting THOSE phone calls. We started getting the error:
[COLOR=red yellow]the data was added to the database but the data won't be displayed in the form because it doesn't satisfy the criteria in the underlying record source [/color]
Now, the form that this is talking about is based on a view with no parameters. So, I tried to enter a record from the table...same error. Everything went back to normal as soon as I took the trigger off of the table. I would appreciate any help with this.
Oh, and I actually have tried 2 different versions. The first actually dumps all of the fields into a History Table. The second dumps the records into an audit table. The audit table only records the field name, new value, old value and table name. Anyway, here is the first trigger:
Thanks in advance for any help.
[COLOR=red yellow]the data was added to the database but the data won't be displayed in the form because it doesn't satisfy the criteria in the underlying record source [/color]
Now, the form that this is talking about is based on a view with no parameters. So, I tried to enter a record from the table...same error. Everything went back to normal as soon as I took the trigger off of the table. I would appreciate any help with this.
Oh, and I actually have tried 2 different versions. The first actually dumps all of the fields into a History Table. The second dumps the records into an audit table. The audit table only records the field name, new value, old value and table name. Anyway, here is the first trigger:
Code:
ALTER TRIGGER tblRequestDetailsReoccuringUpdateHistoryTable
ON dbo.tblRequestDetailsReoccuring
AFTER INSERT, UPDATE, DELETE
AS
BEGIN
IF (SELECT COUNT(*) FROM inserted) > 0
BEGIN
IF (SELECT COUNT(*) FROM deleted)> 0 BEGIN
INSERT INTO dbo.tblRequestDetailsReoccuringHISTORY
(
MonthlyPOID, RequestNumber, TypeOfService, AmountOfService, BudgetAccount,
closed, InputDate, InputUser,Type
)
SELECT MonthlyPOID, RequestNumber, TypeOfService, AmountOfService, BudgetAccount,
closed, InputDate, InputUser,'U'
FROM inserted
END
ELSE
BEGIN
INSERT INTO dbo.tblRequestDetailsReoccuringHISTORY
(
MonthlyPOID, RequestNumber, TypeOfService, AmountOfService,
BudgetAccount, closed, InputDate, InputUser,Type
)
SELECT MonthlyPOID, RequestNumber, TypeOfService, AmountOfService,
BudgetAccount, closed, InputDate, InputUser,'I'
FROM inserted
END
END
ELSE
BEGIN
INSERT INTO dbo.tblRequestDetailsReoccuringHISTORY
(
MonthlyPOID, RequestNumber, TypeOfService, AmountOfService, BudgetAccount,
closed, InputDate, InputUser,Type
)
SELECT MonthlyPOID, RequestNumber, TypeOfService, AmountOfService, BudgetAccount, closed,
InputDate, InputUser,'D'
FROM deleted
END
END
Thanks in advance for any help.