Posted by Cory on July 16, 2001 2:59 PM
Could someone tell me what's wrong with this code?:
Private Sub TextBox1_Change()
If len(TextBox1.Value) > 5 Then
MsgBox "Your entry is too long, Try again."
It's the "cancel" part that's stopping the code, but this was taken directly from a VBA book. I was having a .SetFocus problem and it was suggested that I just cancel instead of setting the focus in order to return to the textbox in event the user entered something I didn't want them to.
Basically, if a user puts something wrong in my textbox, I want a message to pop up telling them this, then return to that textbox to fix the error. Seems simple enough, right?
Please! Thank You!!