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

Field conditions not working on queries 2

Status
Not open for further replies.

EDGE99

Technical User
Oct 9, 2006
58
US
All,

I am having a very strange problem with Access. One I have never seen before. Recently started seeing issue with my queries not working correctly.

I have a query that has lets say 5 fields. And two of these fields have conditions on them.

field one = Specific customer name
field two
field three <> Value or <> Value2

When I run this query the condition on field one is processed correctly but all the records that contain the conditions to field three all show up when the query executes. Has anyone seen anything simular to this before?

I also tried mulitple queries. I put the condition of field one on query1 saved and then created a second query to put the condition on field 3 and I get the same results.



 
Change the Or to And

Lilliabeth
-Why use a big word when a diminutive one will do?-
 
Lilliabeth,

That did the trick. Can you explain why the "OR" would fail. I am not understading why it would fail with the "OR".

I am just a noob at this :)

Thanks
 
Because
Code:
[field three] <> Value or <> Value2
translates to
Code:
[field three] <> Value OR [field three] <> Value1
As long as "Value" and "Value1" are different, [field three] is guaranteed to be not equal to at least one of them no matter what value [field three] has.
 
Golom's correct.

In an OR, ONLY ONE OF THE CONDITIONS MUST BE TRUE IN ORDER FOR THE RECORD TO DISPLAY.

Pretend the field was Color, and your criteria was Not Red OR Not Green.

If the record has "Green", the other condition (Not Red), is true, so the record is displayed.

In an AND, all the conditions must be true in order for the record to display.

Lilliabeth
-Why use a big word when a diminutive one will do?-
 
Ok I understand now.

Thank you both for explaining that to me. I am not sure why I couldn't see that earlier.. (again nooby) :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top