IIF statement to compare two fields.

  • Thread starter E-mail report using Lotus Notes rather t
  • Start date
E

E-mail report using Lotus Notes rather t

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.
 
K

KARL DEWEY

In design view in Field row blank use this with your actual field names --
My_IIF_Results: IIF([Field1] = [Field2], "Yes", "No")
 
J

Jerry Whittle

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top