Forced Input
In the Exit event, you can set cancel = true and the user will not exit the
text box. You can also clear the textbox at that time as well
Text2.Value = ""
--
Regards,
Tom Ogilvy
Garry Jones wrote in message
...
I have a number of text boxes.
The user can not enter the same text into any two text boxes.
This is the part of the code that traps the error.
____________________
If text1 = text2 Then
Dim Med, Uts, Titel, Respons
Med = ("The name " & Text1 & " already exists")
Titel = "Name Entry Error"
Respons = MsgBox(Med, vbOKOnly, Titel)
_____________________
But this does not stop the user from clicking ok and ignoring the
message and clicking on another text box.
How can I force the user to enter correct text in textbox before
allowing them to leave the form. What I really want is to go back to the
original text in the textbox if they fail to enter a valid name.
I have tried this with
TextBox1.change and
TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
But I am still not quite there. Grateful if anyone can point me in the
right direction.
Garry Jones
|