If a user enters too many characters into a field I want to display a message and then keep the user in that text box until less characters are entered.
This is the code
Private Sub txtTitle_LostFocus()
txtTitle.Value = LTrim(txtTitle.Value)
If Len(txtTitle.Value) > 50 Then
MsgBox "Title is too long. Can not be more than 50 characters", vbOKOnly, "Title Too Long"
txtTitle.SetFocus
End If
End Sub
The message appears but focus moves to the next text box almost as if the setfocus command has been ignored.
Anyone got any ideas as to why??
Thanks
This is the code
Private Sub txtTitle_LostFocus()
txtTitle.Value = LTrim(txtTitle.Value)
If Len(txtTitle.Value) > 50 Then
MsgBox "Title is too long. Can not be more than 50 characters", vbOKOnly, "Title Too Long"
txtTitle.SetFocus
End If
End Sub
The message appears but focus moves to the next text box almost as if the setfocus command has been ignored.
Anyone got any ideas as to why??
Thanks
Last edited: