Search code examples
vbams-accessauthenticationuppercaselowercase

How to check the right login data in access form


I've created a nice login form in access. The problem is that I can login altough I use upper- or lowercase for the username or password...

How can I check the right login data which are in the table?

I use this code at the moment:

If Nz(DLookup("Login", "Employee", _
                  "DBPass='" & Me!DBPass & "'"), "") = "'" & Me.User & "'" Then
        MsgBox "The User doesn't exist!", vbOKOnly + vbInformation, "Check"
        Me.User.SetFocus
                  End If

Solution

  • I suggest you keep with the default, however, you can check case with StrComp

     StrComp("Abc","Abc",vbBinaryCompare)
    

    is equal to 0 but

     StrComp("Abc","ABC",vbBinaryCompare)
    

    is equal to 1.