Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2003 Query

Posted on 2013-01-03
2
Medium Priority
?
345 Views
Last Modified: 2013-01-03
I'm not entirely sure what happened because this worked fine on 12/15/2012 but now I am trying to run it and it isn't working.

On the query ZZZZTesting there are 2 difference columns and they are not listening to the <=-0.01 And >=0.01. Any suggestion on how to really eliminate those because there are a lot of them. What baffles me even more is why it even is giving the number. If you look at each of those columns they are exactly the same......... Help appreciated.
Query-Won-t-calc-correctly.zip
0
Comment
Question by:dminx13
[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 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 38741749
i think your criteria is messed up with the use of "AND", "OR"

1. remove the criteria in your query and run

SELECT bpToTake.Number, Status.Status, bpToTake.PlanType, bpToTake.Amount1, IIf([bp_qryTaken]![ETaken] Is Null,0,[bp_qryTaken]![ETaken]) AS Taken, bpToTake.Amount2, IIf(bp_qryTaken!NTB Is Null,0,bp_qryTaken!NTB) AS NTBTaken, [bpToTake]![Amount1]-[bp_qryTaken]![ETaken] AS DeltaAmount1, [bpToTake]![Amount2]-[bp_qryTaken]![NTB] AS DeltaAmount2
FROM ((Staff INNER JOIN bpToTake ON Staff.ID = bpToTake.Number) INNER JOIN Status ON Staff.ID = Status.ID) LEFT JOIN bp_qryTaken ON (bpToTake.PlanType = bp_qryTaken.Type) AND (bpToTake.Number = bp_qryTaken.Number)
ORDER BY bpToTake.Number;

2. add the criteria in DeltaAmount1 and run

SELECT bpToTake.Number, Status.Status, bpToTake.PlanType, bpToTake.Amount1, IIf([bp_qryTaken]![ETaken] Is Null,0,[bp_qryTaken]![ETaken]) AS Taken, bpToTake.Amount2, IIf(bp_qryTaken!NTB Is Null,0,bp_qryTaken!NTB) AS NTBTaken, [bpToTake]![Amount1]-[bp_qryTaken]![ETaken] AS DeltaAmount1, [bpToTake]![Amount2]-[bp_qryTaken]![NTB] AS DeltaAmount2
FROM ((Staff INNER JOIN bpToTake ON Staff.ID = bpToTake.Number) INNER JOIN Status ON Staff.ID = Status.ID) LEFT JOIN bp_qryTaken ON (bpToTake.PlanType = bp_qryTaken.Type) AND (bpToTake.Number = bp_qryTaken.Number)
WHERE ((([bpToTake]![Amount1]-[bp_qryTaken]![ETaken])<=-0.01 And ([bpToTake]![Amount1]-[bp_qryTaken]![ETaken])>=0.01))
ORDER BY bpToTake.Number;


continue adding criteria one at a time and check the result
0
 

Author Closing Comment

by:dminx13
ID: 38741843
Process of Elimination. Must remember that next time. It wasn't the one that I was looking at that was causing the problem, it was the second one. I changed the .01 to be .02 and it worked fine.
Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

604 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