INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Case Sensitive Password Check

Case Sensitive Password Check

(OP)
This is my current code for comparing passwords

If Me.txtPassword.Value = DLookup("Password", "qryUser", "[UserID]=" & Me.cmbUserName.Value) Then

But there is no case sensitive validation. Would appreciate some advise on how to add a case sensitive validation to this code.

RE: Case Sensitive Password Check

StrComp is your friend

RE: Case Sensitive Password Check

(OP)
I tried it with an AND function but I can't seem to get is to work. Here is what I tried out

If Me.txtPassword.Value = DLookup("Password", "qryUser", "[UserID]=" & Me.cmbUserName.Value) And StrComp(Me.txtPassword, Me.cmdUserName.Column(2),1) Then

Could you help me with the code a bit.. I would really appreciate it.

RE: Case Sensitive Password Check

Step 1: use vbBinaryCompare rather than vbTextCompare. The latter is case insensitive ...

RE: Case Sensitive Password Check

(OP)
Tried a code like this to no effect.. Is there a mistake with my code?

If Me.txtPassword.Value = DLookup("Password", "qryUser", "[UserID]=" & Me.cmbUserName.Value) And StrComp(Me.txtPassword.Value, Me.cmbUserName.Column(2), 0) Then

RE: Case Sensitive Password Check

(OP)
I realized that I hadn't defined the output.. It works fine.. Just had to set the output to false..

If Me.txtPassword.Value = DLookup("Password", "qryUser", "[UserID]=" & Me.cmbUserName.Value) And StrComp(Me.txtPassword.Value, Me.cmbUserName.Column(2), 0) = False Then

RE: Case Sensitive Password Check

Glad you got it working

RE: Case Sensitive Password Check

Just for future reference, the simplest way to do this, for any Form where you want comparisons to be Case Sensitive (such as in 'log-on' Forms) is, at the top of the code window for the Form, to replace

Option Compare Database

with

Option Compare Binary

All operations comparing Strings will now be Case Sensitive, with no further syntax adjustments.

Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close