Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Criteria in query <> isn't working with multiple codes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TJAC - 15 Jun 2007 17:20 GMT
I have a query and in one field I am looking for all of the codes, except 6.  
There are too many codes to say I only want to see these...In the criteria I
have entered it as <>AB, or <>CD, etc.  I have also tried going down the rows
for "or" but none of this has worked.  It will only work with one code.

Does anyone have any suggestions or can you tell me why this isn't working?

Thanks!
KARL DEWEY - 15 Jun 2007 17:25 GMT
Not   OR  but AND.  
On the same criteria row enter ---
  <>AB And <>CD And <>DS
Signature

KARL DEWEY
Build a little - Test a little

> I have a query and in one field I am looking for all of the codes, except 6.  
> There are too many codes to say I only want to see these...In the criteria I
[quoted text clipped - 4 lines]
>
> Thanks!
TJAC - 15 Jun 2007 18:11 GMT
That didn't work either...

> Not   OR  but AND.  
> On the same criteria row enter ---
[quoted text clipped - 8 lines]
> >
> > Thanks!
Ken Sheridan - 15 Jun 2007 18:24 GMT
You need to repeat the column name for each Boolean AND operation.  In SQL it
would be:

WHERE YourColumn <> "AB"
AND YourColumn <> "CD"
AND YourColumn <> "DS"

In query design view you'd add the column to the grid once for each value
you need to exclude, uncheck the 'show' check box for all but the first and
in the criteria row of the first put the <> "AB", in that of the second <>
"CD" and so on.

Using a NOT IN operation with a value list as Kerry suggests is simpler,
however.

Ken Sheridan
Stafford, England

> That didn't work either...
>
[quoted text clipped - 10 lines]
> > >
> > > Thanks!
Kerry - 15 Jun 2007 17:26 GMT
Hi

It is working, it just isn't doing what you expected.  If a code is AB
it is true that it is <>AB or <>CD, because it is not CD.  I think you
are looking for <>AB AND <>CD, etc.  You could also use in, for
example not in ("AB","CD","ETC")

> I have a query and in one field I am looking for all of the codes, except 6.
> There are too many codes to say I only want to see these...In the criteria I
[quoted text clipped - 4 lines]
>
> Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.