Thanks. Using that technique, I find that closing the window causes that
event to fire. Is there a way to test for the fact that the Exit event is
firing because a "Close" button is being selected?
"Patrick Molloy" wrote in message
...
you can use the textbox's Exit event...
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Text = "X" Then
Cancel = True
End If
End Sub
"Old Car" wrote:
I have a form with some textboxes on it (textbox1 and textbox2). When
the
user tabs from textbox1 to the textbox2, I validate the contents of the
textbox1 in the textbox1_AfterUpdate event handler. If the content
textbox1
is invalid, I want to keep the cursor in textbox1, rather than tabbing
to
textbox2.
I have tried using textbox1.SetFocus method in the textbox1_AfterUpdate
and
textbox2_Enter event handlers. Neither worked.
What is a good way to do this? Thanks.
|