Alex Gordon
Alex Gordon

Reputation: 60711

using NOT LIKE for parenthesis

here is my expression:

=([Panels] not Like '*IT_AMPH,*' and [Panels] not Like '*AMPH_SN,*' and [Panels] not Like '*AMPH_S,*')

can i say this instead:

= not ([Panels] Like '*IT_AMPH,*' Or [Panels] Like '*AMPH_SN,*' Or [Panels] Like '*AMPH_S,*')

are these expressions the same?

*****i need to mention that my question is not about logic it is about whether access will take this syntax*****

Upvotes: 1

Views: 98

Answers (3)

Martin Smith
Martin Smith

Reputation: 453047

Yep. This is just de Morgan's law. I had to think a bit about the effect of NULLS but in both versions if [Panels] IS NULL then the end result will be unknown.

In answer to your clarified question. Yes as well. I added a new "Yes/No" column to the Northwind Customers table called "TF" and both the following statements had the same effect.

UPDATE Customers SET 
TF = not ([Last Name] Like '*A*' Or 
          [Last Name] Like '*B*' Or 
          [Last Name] Like '*C*');

UPDATE Customers SET 
TF = ([Last Name] not Like '*A*' and 
      [Last Name] not Like '*B*' and 
      [Last Name] not Like '*C*');

Upvotes: 3

Will A
Will A

Reputation: 24988

(NOT A) AND (NOT B) is the same as NOT (A OR B), and this extends to more than two terms. However - sometimes NULL handling can trip you up on this. If you've no NULLs in [Panels] then all will be well, otherwise, test. :)

Upvotes: 3

DaveShaw
DaveShaw

Reputation: 52788

Can't see why not

Upvotes: 1

Related Questions