[RESOLVED] Password Validation
Hey, currently trying to figure out some basic passwork validation for a text box. The first character in the password needs to be a CAPITAL and the last character needs to be a NUMBER. This is what I have so far.
Code:
Private Sub cmdAddUser_Click()
passtest = txtPassword.Text
fPass = Mid(passtest, 1, 1)
PassLen = Len(passtest)
lPass = Mid(passtest, PassLen, 1)
IntCode = Asc(fPass)
LastCode = Asc(lPass)
If IntCode >= 65 And IntCode <= 90 Then
If LastCode >= 48 And LastCode <= 57 Then
With rs
.AddNew
!UserName = txtUser.Text
!Password = txtPassword.Text
.Update
End With
MsgBox "The new User as been successfully added to the system database"
txtUser.Text = ""
txtPassword.Text = ""
txtUser.SetFocus
Else
MsgBox "The password must contain a Capital letter as its first character, and a Number as its last character", vbCritical + vbOKOnly, "Error"
End If
End If
End Sub
Any advice would be much appreciated.
Cheers,
Damien