Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria Question 1

Status
Not open for further replies.

ZartiTech

IS-IT--Management
Apr 10, 2007
16
US
Hi All,

I'm having a problem with Query Criteria in MS Access 2002.

I am running a billing report and I want the report to exclude several clients. Currently If I leave 1 client name in the criteria field, the query runs great and excludes the client from the report

My Client name Criteria field looks like this:
<>"123 Company"

I would like to exclude 3 other companies, but when I put multiple client names in the same field, the filter does not work and when I add them to the OR criteria fields, the query takes 10 - 15 minutes to run and usually freezes.

Here is what I tired, but had no luck with

Criteria: <>"123 Company", "456 Company", "789 Company"

Criteria: <>("123 Company", "456 Company", "789 Company")

Criteria: <>"123 Company", <>"456 Company", <>"789 Company"

I've also tried...

Criteria: <>"123 Company>
OR:<>"456 Company"

Can anyone shed some light on this?

Thanks,
Jon.
 
First, there are seven Access forums for Access questions. You should post this one in Microsoft: Access Queries and JET SQL.
Second, you must understand the difference between OR and AND. Your criteria should look like:

<>"123 Company" And <>"456 Company"

Any other problems with this will be answered in the correct forum.
 

How about...
Criteria: Not In ("123 Company", "456 Company", "789 Company")


Randy
 
It actually seems that the suggestion that fneily made worked fine.

Thanks for the help everyone.

BTW this is the only forum where I can ever get a good answer. Keep up the good work all.
 
ZartiTech:

2 things.

1) you can also use not "123 Company" And not "456 Company"

2) I see you're fairly new to Tek-Tips. Welcome aboard! This is, indeed, a great site to learn and share your knowledge. Seeing as you're new, I'd suggest you consider hitting the link at the bottom of fneily's post that says, "Thank fneily for this valuable post!" That will place a little purple star beside his answer. That, in turn, does a couple of things: It is the "local" way of saying "thanks" (though your taking the time to post back here is surely appreciated as well) and it helps future visitors to identify which post(s) was deemed helpful.

Again, welcome to Tek-Tips! 'Glad you've found it helpful.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top