Re: multiple Criteria

From: Tom Ellison (tellison_at_jcdoyle.com)
Date: 03/31/04


Date: Wed, 31 Mar 2004 13:42:29 -0600

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

On Wed, 31 Mar 2004 11:26:09 -0800, "Georgia"
<anonymous@discussions.microsoft.com> wrote:

>Hi.
>These are the fields i have in the query
>
>Invoice #, Invoice Amount, User ID, Division, District
>
>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!



Relevant Pages

  • Re: update query: still having problems
    ... bring the workstatus field in the grid and, at the criteria line, write: ... UPDATE Department INNER JOIN Sheet1 ON Department.employeeID = ... What I want to do is press a button that will run the query and update the ...
    (microsoft.public.access.queries)
  • Re: Sequence numbering labels
    ... The upper pane of the query design window contains the tables. ... lower pane is the output grid. ... table field to the query output grid' ...that I did not understand, ... and put that count field into the label via label wizard. ...
    (microsoft.public.access.modulesdaovba)
  • Re: VB.NET - How do I return an AutoNumber from an Insert Statement using the DataGridView
    ... > Thanks for that Bart, ... > the values from my Grid to the TableAdapters Insert method. ... >> choose add query, then choose insert query, use a query like below, ... >>> stored in the SQL Database but a VB generated (or disconected dataset ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Using queries in a table adaptor?
    ... using the query wizard I have added several queries ... FROM [Drive Package] ... Not there is no Join here these are just simple Queries on a simple table. ... I am use the flex grid because of some unique features ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: timeline/calendar datagrid
    ... MS Access MVP ... query via code --the query would create a temp table then populate the ... month/year across the top and a grid for each week within each month. ... i'm not interested in the color, etc of the screenshot. ...
    (microsoft.public.access.forms)