Block pre-insert trigger [message #197844] |
Thu, 12 October 2006 20:28 |
secchan20
Messages: 31 Registered: April 2005
|
Member |
|
|
Hi,
My data block from table has where_clause (id_2 = 0). The id_2 has two values 0 or -1. When a record is deleted from the screen, update id_2 to -1 so that it won't show up. My problem arises when user re-enters the same record and commits. I try to update id_2 to 0 by when-button-pressed trigger as follows.
UPDATE mydata SET id_2 = 0 WHERE myrec = :myblock.myrec;
COMMIT;
However form's pre-insert trigger fires before my COMMIT, and gives "FRM-40508 unable to insert" error. Of course! the record already exists in the table with PK!
To block FRM-40508, I added form level on-error trigger, and it blocked the error message! However, commit is not done. After requery, the record re-entered doesn't show up.
How could I go around this pre-insert trigger and update id_2?
Please help!
|
|
|
Re: Block pre-insert trigger [message #197848 is a reply to message #197844] |
Thu, 12 October 2006 20:53 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Instead of running the 'update' statement when you do the 'delete' just change 'id_2' to '-1' and do an execute_query.
David
|
|
|