I think the original problem is that Not has higher precedence than the = equality operator. Thus the condition became
(Not this) = that
It was the (Not this) part that produced the error message.
So the condition should have been Not (this = that), or the equivalent (this <> that).
(Not this) = that
It was the (Not this) part that produced the error message.
So the condition should have been Not (this = that), or the equivalent (this <> that).