stop a triggered macro on exit

Ayas

New member
Local time
Today, 17:06
Joined
Apr 21, 2003
Messages
9
I have put a macro on onexit event of a textbox to make sure it wasn't empty or null, by putting a message box and cancelevent action on the macro.
The problem was when I decided to quit the form and left the text box empty, the macro was always triggered too...the message box was always appearing..it was disturbing, I want to quit and cancel all macro and undo the last record that made the macro triggered.
Anyone help me ? thanks for your help ofcourse...
 
There is most likely more than one way to do this, but what I have done in the past is turn off the windows close button (X at top right) and forces an exit via a button I supplied. Then when clicked I set an invisible field to true (think of it as canceled) and in the macro for the exit event for your text box check the value of that field, and if true ignoer the macro and it's msgbox.
 
Example ?

Would you tell me what the actions of the macro are ? Do you mean disabling the textbox enabled_property ?
 
In the conditions box of the Macro, check it for false (not checked) and then execute your Msgbox and whatever. So basically if the close button sets this invisble check box to true, you macro checks it for false, and runs the msgbox and cancel macro and anything else. If the check box is true, it closes and does whatever.
 

Users who are viewing this thread

Back
Top Bottom