Hi,
Im setting up a Registration form. Two of the fields are CompanyName and UserName. I want both of these fields to have data in them of a certain type and format before the user can move on to complete other fields.
I've set up validations in the AfterUpdate and LostFocus events for these unbound fields. The problem is that I cannot get the VBA code to persist in maintaining focus, even when (clearly) the data in them does not meet the validation criteria.
Here's my AfterUpdate event code:
' validate Company Name input
If (Len(Trim(Me!txtCoName.Value & ""
) < 3) Then
MsgBox "Name is too short!" & Chr(13) & _
"Please use a longer name."
Me!txtCoName.SetFocus
Else
' do nothing
End If
I've also turned off tab stops on all the other fields on the form.
What am I missing here??
thanks L.
Im setting up a Registration form. Two of the fields are CompanyName and UserName. I want both of these fields to have data in them of a certain type and format before the user can move on to complete other fields.
I've set up validations in the AfterUpdate and LostFocus events for these unbound fields. The problem is that I cannot get the VBA code to persist in maintaining focus, even when (clearly) the data in them does not meet the validation criteria.
Here's my AfterUpdate event code:
' validate Company Name input
If (Len(Trim(Me!txtCoName.Value & ""
MsgBox "Name is too short!" & Chr(13) & _
"Please use a longer name."
Me!txtCoName.SetFocus
Else
' do nothing
End If
I've also turned off tab stops on all the other fields on the form.
What am I missing here??
thanks L.