Password Compare

R

Ryan Clair

Simple really. Trying to compare two values (passwords) in a long form.
I'm getting one value from a query I execute upon hitting the "Log In"
button and one that the user has inputed. The problem is, when I write:

If txtPW = txtPassInput.Value And txtUser = txtUserInput.Value And Not
IsNull(txtUser) And Not IsNull(txtPW) Then...

It won't catch that "PassWord" is not equal to "password". Is there a
way around comparing two strings down to the capitalization?

Many thanks.
 
J

Jeff Boyce

Ryan

If I recall correctly, Access doesn't differentiate by case.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

kingston via AccessMonster.com

You can check the password character by character using the Asc() function.
 
J

John Vinson

Simple really. Trying to compare two values (passwords) in a long form.
I'm getting one value from a query I execute upon hitting the "Log In"
button and one that the user has inputed. The problem is, when I write:

If txtPW = txtPassInput.Value And txtUser = txtUserInput.Value And Not
IsNull(txtUser) And Not IsNull(txtPW) Then...

It won't catch that "PassWord" is not equal to "password". Is there a
way around comparing two strings down to the capitalization?

Many thanks.

Access compares are not case sensitive, but you can use the StrComp()
function:

If StrComp(txtPW, Me.txtPassInput, 0) = 0 Then
<the two strings are identical>
Else
<they're not>
End If

John W. Vinson[MVP]
 
Top