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

Query Question

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have created a query for a membership database. The query should select records based on the following criteria:

Field Criteria
Email is not null
city Calgary
Catagory not for profit

or
email2 is not null


The first 3 criteria seem to be working properly but the catagory criteria gives me the not for profit and also includes some other catagory records not requested. It does not include all records for the other catagories just some of them. Can someone please tell me what I'm doing wrong.
 
Since you said "or" email2 is not null, any row with a null email2 will be selected, regardless of the category, city, or email fields. Does that explain it? Rick Sprague
 
Thinking again, you probably wanted this logical expression:
(email is not null or email2 is not null) and city = 'Calgary' and category = 'Not for profit' - right?

In that case, you should duplicate the city and category criteria on the "or" line. The way it works is, each criteria line is evaluated independently. If the criteria on any criteria line is met, the row is selected. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top