View Single Post
 
Old 05-07-2015, 12:42 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 32bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Quote:
My guess is that the exit event on the customer textbox is being activated whenever any of the navigation buttons are being depressed. I do not know why this is.
I believe the cancel=true part keeps the focus with the text box and you can't go anywhere else on your form without exiting the text box first, so as you suspect the procedure runs again. You're stuck in a loop there until the requirements of the text box are satisfied.

Personally I wouldn't do that check until just before writing the info to the spreadsheet, then I'd check everything, one after the other, in the order things get entered, and set focus to anything not acceptable, displaying a message at that point, and exiting the write sub.
Reply With Quote