Validation rule for minimum length of text field?

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
 
F

fredg

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
 
N

Nozza

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
 
N

Nozza

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
 

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