dLookup

D

dave h

Hi,

srchField is a text field in the DB
newNumber & myNumber are both numeric

Any reason this works:

newNumber = DLookup("myNumber", "lookupTable", "srchField = '60003'
")

But this does not:

dim strFld as string
strFld = "60003"

newNumber = DLookup("myNumber", "lookupTable", "srchField = ' " &
strFld & " ' ")

this second version always returns a null - the first version always returns
the correct value

Thanks, Dave H
 
D

dave h

Thanks Duane,

Actually, I put those extra spaces into this explanation just to make it
more readable (dumb on my part). In fact, I did have it like you suggested.
But, you got me thinking and I used "Trim" on the real fields involved and
it WORKED! So, thanks for the advice - it really did help.
 

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

Top