Validation rule for minimum length of text field?

  • Thread starter Thread starter Nozza
  • Start date Start date
N

Nozza

I want users to enter at least 5 characters in field. It could be
more, up to the length of the field.

How do I check that the length of data entered into a field is at
least 5 characters?

Thanks

Noz
 
I want users to enter at least 5 characters in field. It could be
more, up to the length of the field.

How do I check that the length of data entered into a field is at
least 5 characters?

Thanks

Noz

Here is one way:
Set the Validation property of the field to
Len([FieldName])>=5
 
Here is one way:
Set the Validation property of the field to
Len([FieldName])>=5

Haha!

Thanks for that.

I was not putting the field name in square brackets!

Brilliant

Noz
 
One way would be to use the control's Before Update event:

If Len(Me.txtSomeControl) < 5 Then
Cancel = True
MsgBox = "Entry Must Be At Least 5 Characters"
End If

Ooh - that's neat - I like seeing code.

Cheers

Noz
 
Back
Top