Dlookup returns null.

D

Dawn

Dear all,,
I’ve write a dlookup:
sus = DLookup("User_Pwd", "User_Login_Info", "user_pwd=' " & Me.Txt_Cur & "
' ")
it retrun’s null(field :user_pwd,type ,text).
But when I conduct testing,as follows
sus = DLookup("User_Pwd", "User_Login_Info", "user_pwd=' Pwd_Entered ' ")
it will retrun Pwd_entered.
Can anyone explain why?Thanks.
Dawn
 
A

Arvin Meyer [MVP]

Try:

DLookUp("[User_Pwd]","[User_Login_Info]","[user_pwd=]=""" & Me.[Txt_Cur ] &
"""")
 
B

boblarson

Are you absolutely sure that you've spelled everything correctly?

Also, I think you may be barking up the wrong tree as you are trying to
return the password based on the password entered. Shouldn't it be returning
the password based on the USER?

DLookup("User_Pwd", "User_Login_Info", "user='" & Me.Txt_Cur & "'")

that is, if your user name field is named user and the text box is Txt_Cur
for the user.



--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________
 
A

Arvin Meyer [MVP]

Dawn said:
Arvin,
it doesn't work either.
run time error '2001'

Something else must be wrong. Mine added enough double quotes to cover
situations like an apostrophe. But both your original code and mine should
have worked.
 
T

tina

have you checked the value of Me.Txt_Cur *in the running code* to see if
it's returning what you think it is?

hth
 
Top