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!

two critieria in dlookup 1

Status
Not open for further replies.

mishmish

Programmer
May 25, 2001
27
US
Hi,

Does anyone know if it's possible to have two criteria in a dlookup statement? I want to check if a financial statement matches two criteria: a date and the name of a client.

Can I do something like this below where I'm taking from a StatementType field in a Report table only the records that match Date and Client criteria. The Date and Client fields are controls on my form.

DLookup("[StatementType]", "Reports", "[Date] = " &
Date & "[Client] = " & Name)

Is this possible? I haven't been able to get it to work.

Thanks,
mishmish
 
Yes you can do this all you have to do is use the And/Or keywords to combine criteria in a format like so:

=DLookup("[StatementType]","Reports","([Date] = '5/25/01') AND ([Client] = 'XYZ')"

This would give you the Statement type for XYZ on 5/25/01. You'll notice I used the parenthesis around the groups of criteria, this is not necessary, I just do it for better illustration and so it's easier to decifer. Joe Miller
joe.miller@flotech.net
 
Hi Joe,

Thanks a lot. I just tried it out and it did work.

Thanks again,
mishmish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top