Validation Rule

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
 
T

Troy

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
 
M

Mark

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top