IIF Statement

B

Brian

I need to write and IIF statement that says

IIF field 1 is older than 60 days and field 2 equals "whatever", then
exclude field 3.

Any help would be greatly appreciated! Thanks!!
 
O

Ofer Cohen

Try somethig like

IIf((Date() - [field 1]) > 60 And [field 2] = "whatever","" , [Field 3])
 
B

Brian

I was given this, but it doesn't work

IIF (Datetime Added, Now () - 60) and (Doc Title Abrev, <> PICS*), "" , RA #
 
J

John Vinson

I was given this, but it doesn't work

IIF (Datetime Added, Now () - 60) and (Doc Title Abrev, <> PICS*), "" , RA #

Well, I can see half a dozen syntax errors in there - I'm not
surprised it doesn't work!! You might want to ask whoever gave this to
you what language they were using....

Try

IIF(DateDiff("d", [Datetime Added], Date()) > 60 AND [Doc Title Abrev]
NOT LIKE "PICS*", "", [RA #])

Note that fieldnames containing special characters such as blank or #
*must* be enclosed in square brackets; the IIF function has three
arguments; the <> or = operators ignore wildcards; parentheses must
balance; criteria for text fields need to be enclosed in quote marks.

John W. Vinson[MVP]
 
Top