Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the criteria within a query to do XOR

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have four fields: Site, Date, Parameter Code, Reading.
I have the following criteria listed under Parameter Code, and Reading so that I can get the information I need:

Parameter Code | Reading
-----------------------------------------------------------------------------------------------
[Forms]![Generate Report]![Parameter Code] = "ARS" | >0.05
[Forms]![Generate Report]![Parameter Code] = &quot;CAD&quot; | >0.002 And <0.02
| Or >0.02
[Forms]![Generate Report]![Parameter Code] = &quot;CHL&quot; | >5

And so on...
However, it's not just putting up the list of those details when the Parameter Code is &quot;ARS&quot;, it's listing them all, because it is [Forms]![Generate Report]![Parameter Code] = &quot;ARS&quot; OR [Forms]![Generate Report]![Parameter Code] = &quot;CAD&quot;, I think that I need to use XOR, but that then outputs nothing. Please tell me how i can change it so that it outputs either the &quot;ARS&quot; details when the reading >0.05 OR the &quot;CAD&quot; details when the reading is >0.002 and <0.02 or >0.02

Thankyou for your time, and a prompt response would be helpful
 
It would be 'easier' to review the actual SQL statement, but it looks like:


[Forms]![Generate Report]![Parameter Code] = &quot;ARS&quot; | >0.05
[Forms]![Generate Report]![Parameter Code] = &quot;CAD&quot; | >0.002 And <0.02
| Or >0.02


MAY be at least part of the problem.


the thrid line is the area of concern / confusion. re the &quot;CAD&quot; criteria, I could read it either as

1.

&quot;CAD&quot; and (>0.002 and <0.02)

with a new seperate criteria > 0.02 (not associated with any code)
or as
2.

&quot;CAD&quot; and (>0.002 and <0.02) OR > 0.02

In the first instance, the single criteria of >0.02 negates some of the other criteria, as it will pass all recorde where the reading is greater than 0.02 regardless of the code. in the second instance, you should get all recoeds where the code is &quot;CAD&quot; - except the ones where the reading is = 0.02 (exactly).

Another question here is the formulation of the range for &quot;CAD&quot;, where it would be somewhat more 'natural' to use &quot;between 0.002 and 0.02&quot; to specify the contiguious range, although this statement would include the boundary values while your statement will exclude them,


MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top