[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Access query criteria

Posted on 2013-01-28
4
Medium Priority
?
170 Views
Last Modified: 2013-01-28
I have a query that limits the records based on a time frame.  Here is the code:

WHERE (((tblGeneral.dtaDueDate)>Now()-180 And (tblGeneral.dtaDueDate)<Now()-7) AND ((tblGeneral.dtaEstValue)=0))

This also limits the records to the records where dtaEstValue = Zero.

When I add another criteria, the first criteria seems to be disregarded where the date limitations do not apply:


WHERE (((tblGeneral.dtaDueDate)>Now()-180 And (tblGeneral.dtaDueDate)<Now()-7) AND ((tblGeneral.dtaEstValue)=0)) OR (((tblGeneral.[dtaEstLabor$])=0));


Why when I add the "OR" clause to limit the records selected where one or both fieds are zero.  I want to add more "OR" statements for additional fields, but cannot get this one to work.  The goal is to show the records that fall between the date parameters and also have a zero in any of the other fields.
0
Comment
Question by:actolex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38829685
WHERE (dtaDueDate>Now()-180 And tblGeneral.dtaDueDate<Now()-7) AND (tblGeneral.dtaEstValue=0 OR [dtaEstLabor$])=0)
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 38829687
Your parenthesis where in the wrong place.
WHERE (dtaDueDate>Now()-180 And tblGeneral.dtaDueDate<Now()-7) AND (tblGeneral.dtaEstValue=0 OR [dtaEstLabor$]=0)

Open in new window


Ignore my first post. I accidentally submitted it.
0
 
LVL 4

Expert Comment

by:MimicTech
ID: 38829690
WHERE
   ( tblGeneral.dtaDueDate > (Now()-180) )
   And 
   ( tblGeneral.dtaDueDate < (Now()-7) )
   And
   (
      tblGeneral.dtaEstValue = 0
      OR 
      tblGeneral.[dtaEstLabor$] = 0
      OR
      ...
   );

Open in new window

0
 

Author Closing Comment

by:actolex
ID: 38829720
Worked like a charm....old Excel jockies die hard....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question