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 / Queries / May 2005

Tip: Looking for answers? Try searching our database.

Critera question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kmarie - 21 May 2005 03:40 GMT
I need help figuring out the critera operator expression when you're trying
to exclude a piece of information.

For example, here is what my Tests field looks like:

Customer ID    Tests
1    T993, T992, T991
2    T992
4    T995
5    T992, T993
6    T995, T992

I want to query all records that DON'T have test T993 listed. I've tried:

not "T993"
<> "T993"

And those don't seem to work.
Allen Browne - 21 May 2005 04:30 GMT
Try:
   Not Like "*T993*"

Of course, the better solution would be to create a related table to hold
the test numbers.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I need help figuring out the critera operator expression when you're trying
> to exclude a piece of information.
[quoted text clipped - 14 lines]
>
> And those don't seem to work.
John Spencer (MVP) - 21 May 2005 04:38 GMT
IF you have all those values in one field (Tests) then you need to look at a
redesign of your table structure.

HOWEVER, try

 NOT LIKE "*T993*"

as the criteria against the TESTS field

> I need help figuring out the critera operator expression when you're trying
> to exclude a piece of information.
[quoted text clipped - 14 lines]
>
> And those don't seem to work.
Kmarie - 25 May 2005 05:35 GMT
> IF you have all those values in one field (Tests) then you need to look at a
> redesign of your table structure.

What kind of structure would you recommend? The "not like" thing works
great, by the way. Thanks.
John Spencer (MVP) - 26 May 2005 02:03 GMT
Basic structure

Customer Table
CustomerID
CustomerName
Address

Test Table
TestID
TestName
...

CustomerTests Table
CustomerID
TestID
TestDate

Then one way you could get your results would be:

Select CustomerName
From Customer
WHERE CustomerID NOT IN
 (SELECT CustomerID
  FROM CustomerTests
  WHERE TestID <> "T993")

> > IF you have all those values in one field (Tests) then you need to look at a
> > redesign of your table structure.
>
> What kind of structure would you recommend? The "not like" thing works
> great, by the way. 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.