Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IIF statement to compare two fields.

7,591 views
Skip to first unread message

E-mail report using Lotus Notes rather t

unread,
Nov 3, 2009, 4:21:01 PM11/3/09
to
Hi,

I would like to use the IIF statement to compare two fields in Access query
design view. I would like to compare two fields in a query. I know how to
do it in Access using IF statement (i.e. IF(A1=A2, "Yes","No"). Please tell
me how to write an IIF statement in Access to compare two fields. Thank you.

Regards.

KARL DEWEY

unread,
Nov 3, 2009, 4:38:01 PM11/3/09
to
In design view in Field row blank use this with your actual field names --
My_IIF_Results: IIF([Field1] = [Field2], "Yes", "No")

--
Build a little, test a little.

Jerry Whittle

unread,
Nov 3, 2009, 4:41:01 PM11/3/09
to
CompareFields: IIf([Field1]=[Field2],"Yes","No")

However you have to watch out for nulls.

Debug.Print IIf(Null = Null,"Yes","No") will return No even though they are
both nulls.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"E-mail report using Lotus Notes rather t" wrote:

0 new messages