IIf Statement, Please Verify

Superock

Registered User.
Local time
Yesterday, 22:13
Joined
Nov 3, 2004
Messages
40
Hi I have this expression that I built and it does not seem to do what I want.

IIf(Not ([ImportConsolidated]![Comment]=[tblAsset]![Comment]),[ImportConsolidated]![Comment])

Also tried:
IIf([ImportConsolidated]![Comment] Not Like [tblAsset]![Comment],[ImportConsolidated]![Comment])

What I want it to do is...
Compare the two comment fields to each other, if they are not = to one another then the query will update with new comment value.

Thx for the Help
 
You might also need to include "OR [tblAsset].[Comment] Is Null"
 
Code:
WHERE
    (
        [ImportConsolidated].[Comment] <> [tblAsset].[Comment] OR
        [tblAsset].[Comment] Is Null OR
        [ImportConsolidated].[Comment] Is Null 
    ) AND 
    (
        [tblAsset].[Comment] Is Null AND 
        [ImportConsolidated].[Comment] Is Null
    )=False;

I didn't do much thinking in this, so double check me (it might not be completely correct). But the main thing Pat is saying is that you can't compare Null Values, so check if any of the fields are null. But to make sure that they're not the same you also must make sure they're both not blank (or null).
 

Users who are viewing this thread

Back
Top Bottom