Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop next event (e.g., click event) conditionally

Status
Not open for further replies.

Strether

Programmer
Sep 3, 2011
2
US
I must be missing something basic, but I've never been able to figure out how to stop an event (say, a click event) that results after the user leaves a textbox with invalid data. I have all sorts of tricks for trapping the error during change events, but now I'm trying to validate email addresses, and that seems to demand validation during afterupdate.

However, if the user enters an invalid address (no @ or .) and proceeds to close the form by clicking a command button without tabbing out of the textbox first, the afterupdate validation will throw up the error message--and then the form closes anyway. I've tried using "End"; not only does that not work but programmers on this forum advise against it. So what am I missing?
 


hi,

you can use the application.enableevents method to DISABLE events while other code executes. HOWEVER, you must remember to ENABLE events before exiting your procedure in any & every instance.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip, thanks so much! This is just what I was looking for!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top