Sub checkAlphaNumberAndLower()
'Number: ASC(strChar) >= 48 And ASC(strChar) <= 57
'Lower Case: ASC(strChar) >= 65 And ASC(strChar) <= 90
'Upper Case: ASC(strChar) >= 97 And ASC(strChar) <= 122
Dim str As String
Dim strChar As String
Dim i As Integer
Dim LowerFound As Boolean
Dim UpperFound As Boolean
Dim NumericFound As Boolean
On Error GoTo checkAlphaNumberAndLower_Error
LowerFound = False
UpperFound = False
NumericFound = False
str = "BAD" '"Go0d"
'UpperCheck
For i = 1 To Len(str)
strChar = Mid(str, i, 1)
If Asc(strChar) >= 97 And Asc(strChar) <= 122 Then
UpperFound = True
Exit For
Else
End If
Next
'LowerCheck
For i = 1 To Len(str)
strChar = Mid(str, i, 1)
If Asc(strChar) >= 65 And Asc(strChar) <= 90 Then
LowerFound = True
Exit For
Else
End If
Next
'NumericCheck
For i = 1 To Len(str)
strChar = Mid(str, i, 1)
If Asc(strChar) >= 48 And Asc(strChar) <= 57 Then
NumericFound = True
Exit For
Else
End If
Next
'Check Results
If UpperFound = True And _
LowerFound = True And _
NumericFound = True Then
MsgBox str & " is a valid password "
Else
MsgBox str & " is NOT A VALID PASSWORD !!"
End If
On Error GoTo 0
Exit Sub
checkAlphaNumberAndLower_Error:
MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure checkAlphaNumberAndLower of Module AWF_Related"
End Sub