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

x
  • 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.Close
    DoCmd.OpenForm ("Main")
Else
    MsgBox "Invalid Username or Password!" & Chr(13) _
    & "This application will be terminated!", vbExclamation, "Error"
    Application.Quit
End If
End Sub

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

Option Compare Binary

...this should make text comparisons case-sensitive
0
 
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.
0

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