Case Specific Password

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
 
B

BruceM

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.
 
G

Guest

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.
 
G

Guest

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top