Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup with variable as criteria 1

Status
Not open for further replies.

jerseyboy

Technical User
Mar 7, 2002
127
US
GOAL:
I want to compare the password that the user entered with the password that exists for the username in my table.

BACKGROUND:
I have a form with three fields and a cmd button...
I want to put an AFTER UPDATE event in the 'username' field that populates a hidden text box with the password that matches the username in tblUser...

PROGRESS:
I can do it if I hard code the username and use the DLookup formula..
ex: Me.txtLoggedPassword = DLookup("[Password]", "[tblUser]", "[tblUser]![Username] = 'kinglin'")

PROBLEM: I don't want to hard code the username..I want it to use the string value in txtUserName

I have tried various ways to work the problem including referring to the text box, a variable and a combination of both. It doesn't like my series of quotes and dashes!

Your help with my plight will put me in a much better mood, thanks! JerseyBoy
Remember: self-praise is no recommendation
 
jerseyboy,

Me.txtLoggedPassword = DLookup("[Password]", "[tblUser]", "[tblUser]![Username] = '" & me.txtUserName & "'")

Sorry for the typing (laptop).

hth,
Wayne
 
Wayne!
Thanks, I swear that I tried that! I really appreciate your help.
JerseyBoy
Remember: self-praise is no recommendation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top