Case Specific Password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with two controls that is formatted as a "Password". I use the
second control as a confirmation that the user has typed in the correct
password in the first control. It works fine, except it allows the second
password even if the user did not type in the same case--upper or lower. How
can I enforce my database to require the password to be case specific?

Thank you
 
You can use the StrComp function, with vbBinaryCompare:

' Check to see if the two passwords contain the same characters
If StrComp(Me.txtPswd1,Me.txtPswd2,vbTextCompare) = 0 Then
' Check to see if the two passwords have the same case
If StrComp(Me.txtPswd1,Me.txtPswd2,vbBinaryCompare) <> 0 Then
MsgBox "Passwords don't match"
Me.txtPswd1 = Null
Me.txtPswd2 = Null
End If
End If

This is untested code. See VBA Help for more information about StrComp.
 
Don,

Maybe something like this:


if strComp(password, userpassword, vbBinaryCompare)<>0 then
...... your code here.
end if

where password is the password which the usere entered and userpassword is
the password to compare it with.
 
Thank you.
--
Don Rountree


BruceM said:
You can use the StrComp function, with vbBinaryCompare:

' Check to see if the two passwords contain the same characters
If StrComp(Me.txtPswd1,Me.txtPswd2,vbTextCompare) = 0 Then
' Check to see if the two passwords have the same case
If StrComp(Me.txtPswd1,Me.txtPswd2,vbBinaryCompare) <> 0 Then
MsgBox "Passwords don't match"
Me.txtPswd1 = Null
Me.txtPswd2 = Null
End If
End If

This is untested code. See VBA Help for more information about StrComp.
 
Thank you.
--
Don Rountree


Maurice said:
Don,

Maybe something like this:


if strComp(password, userpassword, vbBinaryCompare)<>0 then
..... your code here.
end if

where password is the password which the usere entered and userpassword is
the password to compare it with.
 
Back
Top