Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VBScript to validate a PWD 1

Status
Not open for further replies.

paidere

Programmer
Oct 15, 2001
1
US
I am trying to check that a pwd has at least one numeric character and one alpha character. What is the best way to go about this? Thanks!
 
how about this
I created this in Access but the VBA is the same for ASP
---------------------------------------------
Public Function CheckForAlphaNumeric(Password)
Dim WhichLetter As String
Dim WeGotaCapitaletter, WeGotaLowerletter, WeGotanumber As Boolean
Dim a As Integer
For a = 1 To Len(Password)
WhichLetter = Mid(Password, a, 1)
If Asc(WhichLetter) >= 65 And Asc(WhichLetter) <= 93 Then
WeGotaCapitaletter = True
ElseIf Asc(WhichLetter) >= 97 And Asc(WhichLetter) <= 122 Then
WeGotaLowerletter = True
ElseIf Asc(WhichLetter) >= 48 And Asc(WhichLetter) <= 57 Then
WeGotanumber = True
End If
Next

If WeGotaCapitaletter = True And WeGotanumber = True Then
MsgBox &quot;We have a number and a letter&quot;
ElseIf WeGotanumber = True And WeGotaLowerletter = True Then
MsgBox &quot;We have a number and a letter&quot;
Else
MsgBox &quot;Please make sure you have a Number and a Leter in your password&quot;
End If

End Function
-----------------------------------------
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top