Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2016
    Posts
    3

    Unanswered: Case Sensitive Password Trouble

    I am trying to make my password case sensitive and it is not working. Here is my code:

    Code:
    Private Sub Command1_Click()
    
    Dim user As String
    Dim userlevel As Integer
    Dim TempPass As String
    Dim ID As Integer
    Dim UserName As String
    Dim TempLoginID As String
    Dim password As String
    'Dim icomp As Integer, i As Integer
    
    
    If IsNull(Me.txtUserName) Then
        MsgBox "Please enter LoginID", vbInformation, "LoginID Required"
        Me.txtUserName.SetFocus
    ElseIf IsNull(Me.txtPassword) Then
        MsgBox "Please enter Password", vbInformation, "Password Required"
        Me.txtPassword.SetFocus
    Else
        If StrComp(Me.txtPassword.Value, (DLookup("[Password]", "tblUser", "[Userlogin]= '" & Me.txtUserName.Value & "'")), vbBinaryCompare) = 0 Then
           
        MsgBox "Incorrect LoginID or Password" & vbNewLine & "Please contact an administrator for login information", vbInformation, "Password Required"
        Else
    any help is much appreciated!

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Try replacing
    Code:
    StrComp(Me.txtPassword, password, vbBinaryCompare) = 0
    with

    Code:
    (Me.txtPassword <> password)
    where password = DLookup("[Password]", "tblUser", "[Userlogin]= '" & Me.txtUserName & "'")

    ???

    Just comparing the string directly is case sensitive.
    To make it none case sensitive just use the UCase() or LCase() functions on both strings.



    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •