Queries with Many "or" criteria

G

Guest

I am trying to create a query that will display all records except for ones
that I have listed in the criteria.
The format I am using is <>record1 or <> record2 <> record3... If I do this
for only one record the query works and returns all records except for the
one. When I have two or more records in the criteria, the query runs but
returns all records.
Why is this happening?
 
R

Rick Brandt

masapex said:
More information:
Access 2003 upgraded from Access '97

You need those ANDed instead of ORed. Record1 is returned because of the Or <>
Record2, Record2 comes back because of the <> Record1, etc..
 
G

Guest

I have tried:
Not "record1" and Not "record2"....
<>"record1" and <>"record2"...
<>"record1" or <>"record2"...
Not "record1" or Not "record2"...

None of which work.
The records are int values and primary key in table.
Thanks for the feedback!
 
G

Guest

Try building a query that would pull all the records you do not want.

Second query include the first query joined on the field, all records from
table but only match in first query.

Criteria for field of first query Is Null.
 
J

John Vinson

I have tried:
Not "record1" and Not "record2"....
<>"record1" and <>"record2"...
<>"record1" or <>"record2"...
Not "record1" or Not "record2"...

None of which work.
The records are int values and primary key in table.
Thanks for the feedback!

Try

NOT IN(31, 45, 52, 88)


John W. Vinson[MVP]
 

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