View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
roy_ware roy_ware is offline
external usenet poster
 
Posts: 8
Default Exit Field vs Exit Button......

Just hit a weird one he I'm working with data validation on a form. The
first field on this for is a "must fill" and I check this with an event:

Private Sub txtName_Exit(ByVal Cancel As MSForms.ReturnBoolean)
if txtName.Value = "" then
error message stuff


When I hit the button to exit the screen, I expect to execute the following
code:

Private Sub ExitButton_Click()
Unload Me
MainMenu.Show
End Sub

But!!! If the cursor is positioned on the Name field, execution goes to the
txdtName_Exit routine before exiting!

I've been searching for an event to capture this and bypass the error
message, but have had no luck so far.

Suggestions?????