Dlookup returns null.

  • Thread starter Thread starter Dawn
  • Start date Start date
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
 
Try:

DLookUp("[User_Pwd]","[User_Login_Info]","[user_pwd=]=""" & Me.[Txt_Cur ] &
"""")
 
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

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

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


Back
Top