One-line Password Rule Verification
Category:Forms and Controls
Version Compatibility: Visual Basic 6
I recently had to create code to validate that an entered password would match our rules, which were: Minimum 8 characters, alphanumeric with at least one character and at least one number. For example, "password" was not valid, but "passw0rd" would be fine. Using the VB6 LIKE operator, I condensed it down to one line. The snippet assumes that the field TEXT1 is the one to check. If you need more or less characters, change the number after the LEN function. 'ans' is a boolean field that will have either TRUE or FALSE after evaluation.
Instructions: Copy the declarations and code below and paste directly into your VB project.