Select case using NOT operator

arage

Registered User.
Local time
Today, 18:17
Joined
Dec 30, 2000
Messages
537
Select case using NOT operator
I’d appreciate if somebody could comment on the below code. It doesn’t execute for a value that sets the case to true. Instead it exits to the calling procedure.

GlobalUserCategory is a string and the calling procedures error handler itdentifies the error as 13 a type mismatch.

Code:
            'create regionCombo based on user (see case 4)...
            Select Case GlobalUserCategory
                Case Not "Dir" Or Not "Mgr" Or Not "Coord"
 
Keep in mind De Morgan's Theorem.

(!A OR !B OR !C) = !(A and B and C)

Distributing a Not (!) inverses the logic clause. Therefore, only one has to be false to return true. All must be true to return false. Also, use the Is <>

Select Case GlobalUserCategory
Case Is <> "Dir", Is <>"Mgr", Is <> "Coord"

In this case, one of them is always going to be true, so ...
 
Last edited:
Yup that did it.
 
Last edited:
Well this is kind of confusing to me b/c if say “Dir” is chosen now, it will execute the statement which is wrong.
 

Users who are viewing this thread

Back
Top Bottom