devxlogo

A Simple Password-Checking Routine

A Simple Password-Checking Routine

Developed for a password-reset program, this routine ensures that the user-entered password matches specific password criteria. In this example, the password had to be between 8 and 12 characters long and contain at least one upper case, one lower case, and one numeric character. The order of these didn’t matter, as long as there was one of each.

After doing some testing, I settled on the LIKE operator, which (unlike popular assumptions) isn’t just for database matches.

If (Text1 Like "*[A-Z]*") And _   (Text1 Like "*[a-z]*") And _   (Text1 Like "*[0-9]*") And _   (Len(Text1) > 7 And Len(Text1) < 13) Then   MsgBox "Password has correct usage."Else   MsgBox "Password must be between 8 and 12 characters, " & _   "with one upper case letter, a lower case letter, and one number."End If
See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist