Dlookup......" " and " "

  • Thread starter Thread starter learning_codes
  • Start date Start date
L

learning_codes

Hi,

I need your help.

I want to look up in two columns before opening the queries. It works
for this line but I want to add after CheckLastName.

DLookup("[Last Name]", "Sport", "UCASE([Last Name]) like ""*" &
CheckLastName & "*""")

I'm looking for like this:

DLookup("[Last Name]", "Sport", "UCASE([Last Name]) like ""*" &
CheckLastName & "*""" and [Forecast_Only] is null)

Your help would be much appreciated.

Thanks
 
Try something like this:

DLookup("[Last Name]", "Sport",
"([Last Name] like ""*" & CheckLastName & "*"") and ([Forecast_Only] is
null)"

JET is case insensitive, so the UCASE() is not doing anything useful. Then
you closed the quotes too early. The brackets are optional. If the quotes
don't make sense, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html
 
Back
Top