DLookUp Issue

G

gibsonsgman

Alright, I have the following code in my database for a login app that
i created. I am having an issue with it because at seemingly random
attempts, it gives me the "Invalid Username or Password... try again."
message even though i have entered a correct username/password
combination.

' set global access level to failsafe no access then lookup access
level
GBL_Access_Level = "X"

GBL_Access_Level = Nz(DLookup("[Access_Level]", "[tblUserList]",
"[Username]='" & _
Nz(LCase(Me.cboUsername), " ") & "' and [Password]='" & _
Nz(LCase(Me.txtPassword), " ") & "'"), "X")

' examine results of username/password lookup
If GBL_Access_Level = "X" Then
MsgBox "Invalid Username or Password... try again."
Me.txtPassword = ""
Me.cboUsername = ""
Exit Sub
End If

ANy ideas as to why this would be occuring? I have been thinking about
this for awhile and I am out of ideas. Thanks.
 
G

gibsonsgman

ok, it seems i have discovered another variable to this problem. I
have this under two events. One is a command button and the other is
the forms keydown event

it works if i use teh command button but not if i press enter. any
ideas?>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top