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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Value when two values equal

Status
Not open for further replies.

wally2321

Technical User
May 30, 2001
64
US
I apologize if this is a simple question, but I am having a brain cramp. I am trying to create a table using the design feature of the Make Query. In my query I only want to return values if two fields are greater than zero.

How can I do that....?

Field 1: ROP
Field 2: MIN

I only want to return the records (which includes other fields) when field 1 and field 2 are greater than zero.

If both fields are equal to zero, the values should not be returned.

Any suggestions on how I can do this using the design feature of a make query?

 
Thank you everyone! I guess we took the long way to get the answer. Thanks for the help


Steve
 
Thank you everyone! I guess we took the long way to get the answer. Thanks for the help


 
That worked great! I only return values that are not equal to zero in both fields. What if I want to return all the values that are zero in both fields. Shouldn't the same logic apply?

I did the following:

In the [REORDER POINT] column, I put
=0 in the criteria field

In the [REC MIN ORDER QTY] column, I put
=0 in the criteria field but one row below the =0 in the [REORDER POINT] column.


Shouldn't this work?

Am I missing something again?
 
That will return records when EITHER value is zero because criteria in different rows are OR'd together.
Therefore you now have
[REC MIN ORDER QTY]=0 OR [REORDER POINT]=0

If you want to return records when BOTH values are zero you need them to be AND'd, so put them in the same row.

Here is the way it works, all criteria in the first row are AND'd together. All criteria in the second row are AND'd together. Once the AND's have been performed, all rows are OR'd together.

Therefore:[tt]
A | B | C |
=0 | =0 | =0 |
[/tt]
results in: (A=0) AND (B=0) AND (C=0)

while:[tt]
A | B | C |
=0 | | |
| =0 | |
| | =0 |
[/tt]
results in (A=0) OR (B=0) OR (C=0)

and:[tt]
A | B | C |
=0 | | =0 |
| =0 | |
[/tt]
results in ((A=0)AND(C=0)) OR (B=0)

make sense?
Jonathan
________________________________________
It is not fair to ask of others what you are unwilling to do yourself.
-Eleanor Roosevelt
 
Thanks that makes more sense....Does anyone have an idea of how I can get a better understanding of VB integrated with MS Access? Ang good books?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top