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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up Where

Status
Not open for further replies.

jon159785

IS-IT--Management
Jul 8, 2003
15
US
I'm try to filter a report based on what a user puts in on a form.

For instance I've got the form to build the strWhere based on multiple selections from a List box. What I can't figure out is how to also sort based on 'phase' and vendor number.

For instance I want a strWhere that would only show me records in a report with a certain zip code with a certain vendor with a certain phase.

building this string doesn't work:
strWhere = "cTerritoryZip = '88888' OR cTerritoryZip = '99999' AND cVendor = 1 OR cVendor = 2 AND cPhase = 2"

How would I got about constructing the where statement to filter this properly.

Help is greatly appreciated.
 
I would build the Where string like
strWhere = "cTerritoryZip In('88888', '99999') AND cVendor In(1 , 2) AND cPhase = 2"
There is an FAQ faq703-3936 that has some sample code for doing this.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top