I would like to limit the text typed into a text box to 5 alpha numeric characters. if length is <>5, a message box appears and focus is set back to that text box. However, focus does not go back to the field, it goes to the next tab index even though I code it to. Any suggestions?
thanks
I put in the following code on Lost focus;
AgtNum = TxtAgntNum.Value
Length = Len(AgtNum)
If Length <> 5 Then
Response = MsgBox("Incorrect Agent Number. Must be 5 digits", vbOKOnly)
Forms![Agent Address Change]!TxtAgntNum.SetFocus
Exit Sub
End If
thanks
I put in the following code on Lost focus;
AgtNum = TxtAgntNum.Value
Length = Len(AgtNum)
If Length <> 5 Then
Response = MsgBox("Incorrect Agent Number. Must be 5 digits", vbOKOnly)
Forms![Agent Address Change]!TxtAgntNum.SetFocus
Exit Sub
End If