Append query with multiple criteria not working

foxtrot123

Registered User.
Local time
Today, 14:24
Joined
Feb 18, 2010
Messages
57
I have an append query that appends records from Table X to Table Y where Color is Null or <> "Red":

Code:
WHERE (((tblColors.Color)<>"Red" Or (tblColors.Color) Is Null));
This works fine. But when I try to add a third condition, like <> "Orange", it seems to ignore the <>Red and <>Orange criteria, and appends all records regardless of color.

I've tried it two ways and both have the same result:

Code:
WHERE (((tblColors.Color)<>"Red" Or (tblColors.Color)<>"Orange" Or (tblColors.Color) Is Null));
and

Code:
WHERE (((tblColors.Color)<>"Red" Or (tblColors.Color) Is Null)) OR (tblColors.Color)<>"Orange" Or (tblColors.Color) Is Null));

Any suggestions?
 
Try;
Code:
WHERE (((tblColors.Color)<>"Red" [B][COLOR="Red"]And[/COLOR][/B] (tblColors.Color)<>"Orange" Or (tblColors.Color) Is Null));
 
...quick tip, when building these types of query build them as a select query first to ensure you are producing the desired result, then convert them to an Append query, once you are happy it's doing what you want.
 
...quick tip, when building these types of query build them as a select query first to ensure you are producing the desired result, then convert them to an Append query, once you are happy it's doing what you want.
Good idea. And your code worked. Thanks.
 

Users who are viewing this thread

Back
Top Bottom