multiple Criteria

G

Guest

Hi.
These are the fields i have in the quer

Invoice #, Invoice Amount, User ID, Division, Distric

Under User ID, under criteria, i have put --- like[UserID:], under or = like [UserID:] is null.
So that when query is ran, it will prompt you to type in your User ID to pull only your record. Or if you leave it blank, it will pull every record

My question is how do I set this up under Division and District also
When I put under Division =[Division:] or is null and under District = [District:] or is null.., when I run the query, type in my user ID number and leave District and Division blank, it will not pull my user ID name with all district and division

I want to run a query where it will prompt to ask me those three criterias and pulls correct informations

For example
I type my name, i don't know the district , but i know the division. i want the query to pull my name, the division i type but all district since i did not specifiy which one
Please help

Thank you!
 
T

Tom Ellison

Dear Georgia:

When your query contains complex logic that includes multiple ANDs and
ORs, the Query Design Grid makes a mess of it. While it is possible
to work within the grid, you're going to be an expert logician to do
it.

I suggest you work out the SQL for your criteria. This allows you
parenthesized notation that will make the job easier for humans.

The WHERE part of your query can be entered as:

WHERE (UserID = [UserID:] OR [UserID:] IS NULL)
AND (Division = [Division:] OR [Division:] IS NULL)
AND (District = [District:] OR [District:] IS NULL)

When you have entered this, save it as another, temporary query name,
and see if it works. Then you can go to the grid and see what a mess
it is there. It will make you glad you leanred SQL!

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
G

Guest

This did not work, does anyone know any other way

Thank you!

----- Tom Ellison wrote: ----

Dear Georgia

When your query contains complex logic that includes multiple ANDs an
ORs, the Query Design Grid makes a mess of it. While it is possibl
to work within the grid, you're going to be an expert logician to d
it

I suggest you work out the SQL for your criteria. This allows yo
parenthesized notation that will make the job easier for humans

The WHERE part of your query can be entered as

WHERE (UserID = [UserID:] OR [UserID:] IS NULL
AND (Division = [Division:] OR [Division:] IS NULL
AND (District = [District:] OR [District:] IS NULL

When you have entered this, save it as another, temporary query name
and see if it works. Then you can go to the grid and see what a mes
it is there. It will make you glad you leanred SQL

Tom Elliso
Microsoft Access MV
Ellison Enterprises - Your One Stop IT Expert


On Wed, 31 Mar 2004 11:26:09 -0800, "Georgia
Hi.
These are the fields i have in the quer
Invoice #, Invoice Amount, User ID, Division, Distric
Under User ID, under criteria, i have put --- like[UserID:], under or = like [UserID:] is null.
So that when query is ran, it will prompt you to type in your User ID to pull only your record. Or if you leave it blank, it will pull every record
My question is how do I set this up under Division and District also
When I put under Division =[Division:] or is null and under District = [District:] or is null.., when I run the query, type in my user ID number and leave District and Division blank, it will not pull my user ID name with all district and division
I want to run a query where it will prompt to ask me those three criterias and pulls correct informations
For example
I type my name, i don't know the district , but i know the division. i want the query to pull my name, the division i type but all district since i did not specifiy which one
Please help
Thank you
 

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

Top