Criteria- "Not like..."

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to set the criteria so it pulls all data EXCEPT for records that
include "book", etc. How do I compbine the "Not" and "like" critieria?
 
Yep, in the criteria for the field that might contain "book", enter:

Not Like "*book*"
 
I need to set the criteria so it pulls all data EXCEPT for records that
include "book", etc. How do I compbine the "Not" and "like" critieria?

As Edward says, please post your SQL. NOT logic can get tricky when
combined with AND/OR logic.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
This may sound stupid, but how do I post the SQL?
Do you want the whole query....
 
In Design View click "View" on the menu bar. From the drop down list select
"SQL View". Copy and paste the SQL
statement into your post.
 
SELECT iMIS_Name.MEMBER_TYPE, iMIS_Name.FULL_NAME, iMIS_Name.TITLE,
iMIS_Name.COMPANY, iMIS_Name.FULL_ADDRESS, iMIS_Name.WORK_PHONE,
iMIS_Name.FAX, iMIS_Name.EMAIL
FROM iMIS_Name
WHERE (((iMIS_Name.MEMBER_TYPE)="X") AND ((iMIS_Name.COMPANY) Not Like
"*book*")) OR (((iMIS_Name.MEMBER_TYPE)="X") AND ((iMIS_Name.COMPANY) Not
Like "*Barnes*")) OR (((iMIS_Name.MEMBER_TYPE)="X") AND ((iMIS_Name.COMPANY)
Not Like "*Amazon*")) OR (((iMIS_Name.MEMBER_TYPE)="X") AND
((iMIS_Name.COMPANY) Not Like "*Border*"));
 
Laura,
Please try replacing the SQL in your query with the amended text below. Or
in the QBE grid
remove all but the first "X" in the Member_Type criteria and in the Company
field enter your "not likes" like this:
not like "*book*" And not like "*barnes*" And not like "*Amazon*" And not
like "*Border*" in the same row
as your "X" in Member_Type.

SELECT iMIS_Name.MEMBER_TYPE, iMIS_Name.FULL_NAME, iMIS_Name.TITLE,
iMIS_Name.COMPANY, iMIS_Name.FULL_ADDRESS, iMIS_Name.WORK_PHONE,
iMIS_Name.FAX, iMIS_Name.EMAIL
FROM iMIS_Name
WHERE (((iMIS_Name.MEMBER_TYPE)="X") AND ((iMIS_Name.COMPANY) Not Like
"*book*" AND (iMIS_Name.COMPANY) Not Like "*Barnes*" AND (iMIS_Name.COMPANY)
Not Like "*Amazon*" AND (iMIS_Name.COMPANY) Not Like "*Border*"));
 
It worked!!!!
Thank you :-)

Edward G said:
Laura,
Please try replacing the SQL in your query with the amended text below. Or
in the QBE grid
remove all but the first "X" in the Member_Type criteria and in the Company
field enter your "not likes" like this:
not like "*book*" And not like "*barnes*" And not like "*Amazon*" And not
like "*Border*" in the same row
as your "X" in Member_Type.

SELECT iMIS_Name.MEMBER_TYPE, iMIS_Name.FULL_NAME, iMIS_Name.TITLE,
iMIS_Name.COMPANY, iMIS_Name.FULL_ADDRESS, iMIS_Name.WORK_PHONE,
iMIS_Name.FAX, iMIS_Name.EMAIL
FROM iMIS_Name
WHERE (((iMIS_Name.MEMBER_TYPE)="X") AND ((iMIS_Name.COMPANY) Not Like
"*book*" AND (iMIS_Name.COMPANY) Not Like "*Barnes*" AND (iMIS_Name.COMPANY)
Not Like "*Amazon*" AND (iMIS_Name.COMPANY) Not Like "*Border*"));
 

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

Back
Top