Something like this should do it, replacing YourControl with the actual name
of your control:
Private Sub YourControl_BeforeUpdate(Cancel As Integer)
Dim I As Integer
Dim Hits As Integer
Hits = 0
'This insures that string is AA1234 format
For I = 1 To 2
If IsNumeric(Mid(Me.YourControl, I, 1)) Then
Hits = Hits + 1
End If
Next I
For I = 3 To 6
If Not IsNumeric(Mid(Me.YourControl, I, 1)) Then
Hits = Hits + 1
End If
Next I
If Hits > 0 Then
MsgBox "This field must be in the format AA1234 with no spaces!"
Cancel = True
Me.YourControl.SelStart = 0
Me.YourControl.SelLength = Len(Me.YourControl)
End If
End Sub
>Hi all,
>Can someone please tell me the code to ensure a user enters only the
[quoted text clipped - 11 lines]
>
>J