Private Sub PWString_LostFocus()
Dim I As Integer
Dim Hits As Integer
Hits = 0
'This insures that the password is 8 characters long
If Len(Me.PWString) <> 8 Then
MsgBox ("Passwords must be 8 digits long!")
Me.SubmissionButton.SetFocus
Me.PWString.SetFocus
Me.PWString.SelStart = 0
Me.PWString.SelLength = Len(Me.PWString)
End If
'This insures that all characters are Alpha/Numeric
For I = 1 To Len(Me.PWString.Value)
ANChar = Mid(Me.PWString, I, 1)
If ((Asc(ANChar) >= 48 And Asc(ANChar) <= 57)) Or ((Asc(ANChar) >= 65 And Asc(ANChar) <= 90)) Or ((Asc(ANChar) >= 97 And Asc(ANChar) <= 122)) Then
'Do nothing
Else: Hits = Hits + 1
End If
Next I
If Hits > 0 Then
MsgBox "All characters must be Letters or Numbers"
Me.PWSubmissionButton.SetFocus
Me.PWString.SetFocus
Me.PWString.SelStart = 0
Me.PWString.SelLength = Len(Me.PWString)
End If
End Sub