"Not like" except for one instance?

buffettjr

New member
Local time
Yesterday, 23:17
Joined
Nov 13, 2008
Messages
4
First off, thank you all so much for the help you provide.

I'd like to write a query were I exclude a row any time a project number starts with 9CT with the except of the one instance where it says 9CTAT

So lets say we have data like this:
7CTmisc
9CT01
9CTRJJ
9CT45
9CTmisc
9CTAT
10CT11

I want to do a query where I list all my project numbers, but I don't want the ones that start with 9CT, but I do want the one instance that is 9CTAT.

So I want my query to return these records:
7CTmisc
9CTAT
10CT11

Is there any way to do that? I already have code that says

WHERE tblMASTERS.NAME Not Like '*9CT*

I just need to add the part about "unless 9CTAT"

Any help would be appreciated!
 
Try:

WHERE tblMASTERS.NAME Not Like '*9CT* OR tblMASTERSNAME Like "9CTAT*"
 
Try:

WHERE tblMASTERS.NAME Not Like '*9CT* OR tblMASTERSNAME Like "9CTAT*"

Oh. Right.

I tried this once and i got all blanks...but it turned out I was searching December 2009 rather than December 2008 so of course it would come up blank (it is currently July 2008!).

Sorry, and thanks for the help. The code worked perfectly!
 

Users who are viewing this thread

Back
Top Bottom