Is there an easier way of writing this in a query

bearcub

Well-known Member
Joined
May 18, 2005
Messages
701
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I have a number of members that I need to exclude from a particular query. What I did was to have a string of Not Like Statements in the criteria section of the query to exclude these members from the query. Is there another way to do this in access?

This is the what I presently have and it works. I just wonder if there is another way of doing this:

Not Like "Elana Davidson" And Not Like "Dean E. Vogel" And Not Like "John C. Stocks" And Not Like "Joe Nuñez" And Not Like "Becky Pringle" And Not Like "Dr. Theresa Montaño" And Not Like "lily*" And Not Like "Princess R. Moss" And Not Like "Eric C. Heins" And Not Like "Mike Myslinski"

Thank you for your help,

Michael
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Code:
where 
(
  (
    not in ( 
      'Elana Davidson', 
      'Dean E. Vogel', 
      'John C. Stocks', 
      'Joe Nuñez', 
      'Becky Pringle', 
      'Dr. Theresa Montaño', 
       'Princess R. Moss', 
      'Eric C. Heins', 
      'Mike Myslinski' 
    ) 
  )
  and 
  (
    not like 'lily*'
  )
)
 
Upvote 0
Thank you. Is this what you've written here in SQL or in the design view of the query. If this in in SQL, how would I write this in the actual query itself.

Michael
 
Upvote 0
For queries, in addition to Design View, Access has has SQL View. As long as what you are trying to do can be represented in Design View, you can bounce back and forth between these two views (certain types of queries, like Union queries, can only be seen in SQL View). So you could add this criteria in either View.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,943
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top