Password Compare

  • Thread starter Thread starter Ryan Clair
  • Start date Start date
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.
 
Ryan

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

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
You can check the password character by character using the Asc() function.
 
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]
 

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

Back
Top