Make a text box case sensitive

Posted on 2003-03-07
Medium Priority
Last Modified: 2008-03-06
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
Question by:philwants2bgolfn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

funke earned 300 total points
ID: 8091387
...in your code behind module (at the top) use the directive:

Option Compare Binary

...this should make text comparisons case-sensitive

Author Comment

ID: 8091600
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question