I'm running out of ideas, any suggestion is appreciated.What have you tried? I would suggest checking the dates in the Pre-Delete trigger and then block the delete if the remaining records date values don't line up, but perhaps you have already tried this!
I put the code in 'Key-Commit', the error message is popping out fine and not allowing to save. But when i tried to close the form using 'cross' symbol then it is asking to save/cancel/discard options here when i choose 'Save' it is accepting which should not happen.
Any thoughts regarding.
This code sample assumes you have a generic Alert named "CAUTION" and that you reuse your alerts rather than create multiple alerts.
/* Sample When-Window-Close trigger. */ /* This sample "ASSUMES" you have an Alert Object named "CAUTION" */ DECLARE al_button NUMBER := 0; al_id ALERT; BEGIN IF ( :SYSTEM.FORM_STATUS != 'QUERY' OR :SYSTEM.BLOCK_STATUS != 'QUERY' ) THEN --Form has uncommitted changes. al_id := Find_Alert('CAUTION'); IF ( ID_NULL(al_id) ) THEN Message('CAUTION alert does not exist.); Message(' '); RAISE Form_Trigger_Failure; ELSE Set_Alert_Property(al_id,ALERT_MESSAGE_TEXT,'There are unsaved changes! What do you want to do?'); Set_Alert_Button_Property(al_id,ALERT_BUTTON1,LABEL,'Save'); Set_Alert_Button_Property(al_id,ALERT_BUTTON2,LABEL,'Cancel'); Set_Alert_Button_Property(al_id,ALERT_BUTTON3,LABEL,'Discard'); al_button := Show_Alert(al_id); IF ( al_button = ALERT_BUTTON1 ) THEN --Save Call your Key-Commit procedure... ELSIF ( al_button = ALERT_BUTTON2 ) THEN --Cancel RAISE Form_Trigger_Failure; ELSE --Discard Clear_Form(NO_VALIDATE); END IF; END IF; END IF; Exit_Form; END;