Solved

Access 2003 Query

Posted on 2013-01-03
2
339 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
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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