Validation Rule

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I put the following validation rule on a field:
Is Null OR Not Like "*[!((a-z) or (0-9))*"
The rule is suppose to only allow letters and numbers, however it will not
allow anything! Any suggestions on what I am doing wrong. (I have access
2000 not sure if this matters.
Thanks,
Eric
 
Eric:

Try:

Is Null Or [FieldNameGoesHere] Not Like "*[!a-z,!0-9]*"

In a form you could use the control's KeyPress event procedure. This has
the advantage of allowing or reject each character individually, e.g.

Select Case KeyAscii
Case 97 To 122 ' a-z
' accept
Case 65 To 90 'A-Z
' accept
Case 49 To 57 ' 0-9
' accept
Case 8 ' backspace
' accept
Case Else
' reject
KeyAscii = 0
End Select

Ken Sheridan
Stafford, England
 
Try

NOT LIKE "*[!0-9A-z]*"

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top