Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Delete Warning Message
When I use Send_Event(@Window, "DELETE"), I will always get a system message to verify that the user really wants to delete the record. Is it possible to bypass this system message?
Comments
I honestly don't think you can do this directly. The DELETE event itself does not have a suppressWarning argument the same way the CLEAR event does. I think you best bet is to use the CLEAR event handler (with the suppressWarning argument set to True), and then delete the row using the Delete or the Delete_Row subroutine.
You can also trap the SYSMSG event handler and return a 0 so the SYSMSG system event handler does not process the message box. Since you have to intercept this before the system event handler, you would either need to do this in a script event handler or in a promoted SYSMSG event handler.
When I did my proof of concept testing on this, I found that the MsgCode argument was populated with a value of 2 (SYSMSG_DELETEWARN$). I'm not sure why you are getting a null other than perhaps you just happen to be catching other system messages that do not populate this argument (which still seems strange).
My first advice is to just test for the SYSMSG_DELETEWARN$ value. Does this ever come up when you send the DELETE event to the form?
If you manage to trap this, then you need to decide if you always want to disable the Delete Warn message or only under certain conditions. If the latter, then I recommend creating a user-defined property in your code that sends the DELETE event and then check this UDP in your SYSMSG event handler. That way you can limit the functionality to both the specific system message and to specific conditions. Just make sure you clear the UDP so this does not affect future activities.
To suppose the message box itself, just return a 0. To allow the message box to appear then return a 1.