Conventional wisdom suggests this code works fine when checking a field in a database-or any Variant, for that matter-for inequality to some other value:
If ![Name] <> "abc" Then Debug.Print "<>"Else Debug.Print "="End If
In reality, however, this isn’t always the case. For example, if the field you’re checking is of value Null, then the test also returns Null, invoking the Else clause. A quick, though perhaps obscure solution, is to check for equality instead:
If ![Name] = "abc" Then Debug.Print "="Else Debug.Print "<>"End If