Validation Rule

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a validation rule that checks to see if the user
entered 2 digit in a textbox. If not a 2 digit entry I need to display a
message.

The field is used to sort the records.

01 vs 1

Does anyone have a suggestion?

Thanks in advance!

Dwight
 
Try:

Len([TextBoxName]) =2 AND IsNumeric([TextBoxName])

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


I am trying to create a validation rule that checks to see if the user
entered 2 digit in a textbox. If not a 2 digit entry I need to display a
message.

The field is used to sort the records.

01 vs 1

Does anyone have a suggestion?

Thanks in advance!

Dwight
 
In your table design, you can use an input mask for the field.
Or, you can use an input mask for the control on your form.
Or, you can put code similar to this in the AfterUpdate event for the
textbox:
If IsNumeric(Me.Text5) Then
If Len(Me.Text5) <> 2 Then
Me.Text5 = ""
MsgBox "Need two digits"
End If
Else
Me.Text5 = ""
MsgBox "Only numbers, please"
End If
 
Back
Top