Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Make a text box case sensitive

I have a form that request the user to type in the administrator username and password.  It searches for the correct password for the administrator.  Now if the user name is "AdMiN" and the user types "admin" it will open.  I would like the field to be case sensitive.  Is this possible?

Here is my code:

Private Sub cmdEnter_Click()
If txtUser.Value = "Admin" And txtPassword = Password.Value Then
    DoCmd.OpenForm ("Main")
    MsgBox "Invalid Username or Password!" & Chr(13) _
    & "This application will be terminated!", vbExclamation, "Error"
End If
End Sub

I tried Option Compare Text and it barked at me.
Any help would be great.  Thanks
1 Solution
...in your code behind module (at the top) use the directive:

Option Compare Binary

...this should make text comparisons case-sensitive
philwants2bgolfnAuthor Commented:
I got the response below when I added that to my code.  So I took out the Option Compare Database and it worked fine.  Thanks for getting me on the help!

The expression On Click you entered as the event property setting produced the following error:  Duplicate Optoin statement.

*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now