Two approaches come to mind.
First, you might look at whether the lock style is set to optimistic or pessimistic. This is a form property.
Second, the trap would have to go in the button code. The only reason you get the box is because the default error handler code for buttons is
xbutton_click_error:
msgbox err.description
resume xbutton_click_exit
The box you want to lose is triggered by that msgbox function. To get rid of the box, modify that code to do something else like reset the form to look just like it did before the button was pressed. Or maybe supply a different message.