validation number

teiben

Registered User.
Local time
Today, 22:22
Joined
Jun 20, 2002
Messages
462
I'm stumped, and assume the answer is easy but.....I have a number field, <number> w/4 characters. For data entry the users need to type in 4 numbers from a card. I made the field size 4 and made it required, but how would I stop the user from entering 3 or 2 characters?
 
Hello:

You would want to test for the length of the entry. You use the Len function to do this. For instance:

If Len(Text1.Text) < 4 Then
Beep
Msgbox "Entry is less than four characters"
End If

You would put this on the BeforeUpdate event of your control.
Regards
Mark
 
If Len(Text1.Text) < 4 Then
Beep
Msgbox "Entry is less than four characters"
End If

You would put this on the BeforeUpdate event of your control.
AND set Cancel = True to hold the user in the control.
 
Hello: Rural Guy
Thanks for cleaning up after me on this one.
Regards
Mark
 

Users who are viewing this thread

Back
Top Bottom