Hi,
I have this code to validate input into a field. the problem is that the focus is not reset back to the field if there is a problem, it goes to the next field.
----------
Neil
I have this code to validate input into a field. the problem is that the focus is not reset back to the field if there is a problem, it goes to the next field.
Code:
Private Sub FName_LostFocus()
mmsg = " is invalid. It can not contain ' and "
mmsg = mmsg & Chr(34)
mmsg = mmsg & " in the same line."
If IsNull(Me.FName) = False Then
stpos = InStr(1, Me.FName, "'", vbTextCompare)
stpos1 = InStr(1, Me.FName, Chr(34), vbTextCompare)
If stpos <> 0 And stpos1 <> 0 Then
xx = MsgBox(Me.FName & mmsg, vbCritical)
Me.FName.SetFocus
End If
End If
End Sub
----------
Neil