Solved Require minimum # of character in unbound field

donkey9972

Registered User.
Local time
Today, 08:37
Joined
May 18, 2008
Messages
193
Hi,

I have a form which does a password change using 2 unbound fields. I want the fields to require a minimum of 6 characters but I do not know if that is done in the validation rule or using VBA. Stupid me I tried to do it in the table it updates to, but since the fields are unbound... well it didn't work 😞.

I did try this on the fields on the form in the Validation Rule:
Code:
Len([CLM_no]) = 6

But it only gave me this error:

The expression [CLM_no] you entered in the form control's ValidationRule property contains the error The object doesn't contain the Automation object 'CLM_no.'.

Any help to point me in the right direction?
 
That will restrict you to exactly 6 characters.
If it's an unbound form then in the "Change Password" command button use something like

Code:
If Len(Me.MyNewPasswordControl) < 6 Then
  msgbox "The new password supplied is not long enough",vbInformation,"Check Password"
  Me.MyNewPasswordControl.SetFocus
  exit Sub
End if

Process the rest of the pasword update here....

Replace MyNewPasswordControl with the actual name of your New Password text box.
 
Use the builder to build the expression.
1731585138943.png
 
Thank you for the information Minty. Being limited to exactly 6 characters is a problem. I just wanted a minimum of 6 characters but up to as many as they want. I think I found something not requiring VBA that works.

Also thank you gasman, I build it and ended up using this
Code:
Len([txtPassword])>=6 Or Is Null

This way I can do the minimum I want and not limit it to just 6. This was solved, again thank you both.
 
I do not think you want Null in there?
 
You also want properties set at the table level
Required = Yes
AllowZeroLengthStrings = No

And if you are going to use the validation rule, put it on the table NOT in the form.
 

Users who are viewing this thread

Back
Top Bottom