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
 
Ad

Advertisements

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.
 
Ad

Advertisements

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
 
Ad

Advertisements


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

DLookUP and Null 4
dlookup/null 2
Date returns null 11
Date Returns Null 4
Dlookup returning weird values? 1
Dlookup returning the wrong values 2
Returns Null based on Column? 1
lstBox value returns null 1

Top