Dear Old DLookup

  • Thread starter Thread starter DubboPete
  • Start date Start date
D

DubboPete

It must be the most frustrating piece of code in the (Access) world for
those of us with selective memory...

I want to look up a value of a field from a table based on the user's entry
in another field.
Not hard is it?

yeah right.

What's wrong with this?

=DLookUp("password","tblusers","[username] = " &
[Forms]![frmLogin]![username])

thanks and happy St Pat's Oblivion-by-alcohol Day!

StigOfTheDump
 
Pete,

First, the field name to look up must be enclosed in square brackets.
Second, if this is indeed in code, as you imply, then the reference to
the form control for the username (presumably text) must be enclosed in
quotes. Try this:

=DLookUp("[password]","tblusers","[username] = '" &
[Forms]![frmLogin]![username] & "'")

(watch out for wrapping in your newsreader).

P.S. don't feel bad about this, domain aggregate functions take a long
time to digest!

HTH,
Nikos
 
Thanks Nick, but actually... it didn't work!! :-(

but this did...

=DLookUp("[Password]","TblUsers","[Username] =
[Forms]![FrmLogin]![username]")

go figure! :-)
thanks for the help mate

DubboPete
currently in A97 timewarpzone
 
Pete,

It depends on the context... remember I said "if this is indeed in
code"? Your syntax would work in a form, report, query, or macro.
You will figure it out in time, but like I said (also), it takes some
time to digest!

Nikos
 
Nikos,

observe the embedded smileys in my last email ! :-)

It was indeed within a form, as are (99%) most instances of my DLookups....
therefore....

it works...

cheers
Pete
 

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

String and Dlookup 3
Advanced Login Controls - Can you help? 3
DLookUp syntax 9
DLookup Help 4
Filter Based on Log On 1
Syntax problem with Dlookup 2
Help with Logon form 1
dlookup criteria & related 8

Back
Top