If Not User_ID = 1
is false (because User_ID = 1
is false), then Not User_ID = WL_UserID
is true. That's all there is to it .. but, the logic error can be seen as follows.
The initial expression,
Not User_ID = 1 OrElse Not User_ID = WL_UserID
can be rewritten as
Not (User_ID = 1 AndAlso User_ID = WL_UserID)
by application of De Morgan's Law. This reads as: "It is not the case that User_ID is 1 and User_ID is WL_UserID". Assuming that 1 <> WL_UserID
, then the inner AndAlso expression is always false (as User_ID cannot be equal to two different values at once) and the entire expression is true - always.
On way to solve the original, which is what I recommend, is to have one Not on the outside:
Not (User_ID = 1 OrElse User_ID = WL_UserID)
The changed expression reads as: "It is not the case that User_Id is 1 or User_Id is WL_UserID".
However, taking the now correct expression, it is trivial to transform it back to an equivalent with the Not's inside, again by application of DM. (I'm not a fan of this construct and avoid it most of the time.)
Not User_ID = 1 AndAlso Not User_ID = WL_UserID
Or, with transformation of the comparison operators (Not x = y
-> x <> y
),
User_ID <> 1 AndAlso User_ID <> WL_UserID