Calculated value in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone please help me figure out why the following will not work in a
report textbox: iif(ctyp='OLD', or ctyp = 'NEW','yes','no'). Ctyp is the
name of a column in a query from which the values are drawn for the report.
When I run the report, it requests a parameter value for the IIF statement.

Thank you,
Garry
 
You have one comma to match

Yours
iif(ctyp='OLD', or ctyp = 'NEW','yes','no')

Try
iif(ctyp='OLD' or ctyp = 'NEW','yes','no')
Or
iif(ctyp In ('OLD', 'NEW'),'yes','no')
 
Unless [ctyp] can be a null or something else, this is all you need.

= IIf([ctyp] = "OLD", "yes", "no")

the above would return "yes" for "OLD".
"no" for anthing else.

Lou
 
Unless [ctyp] can be a null or something else, this is all you need.

= IIf([ctyp] = "OLD", "yes", "no")

the above would return "yes" for "OLD".
"no" for any thing else.

Lou
 
The comma is a typeo in the question. I think the IIF statement does not
work with a query in a report. Do you have any experience with that? I
wound up putting the IIF in the query, but it would have been nice if I could
have left the query more generic and put the IIF in the report total.

Thanks anyway
 
You can use IIf as a Control source of a text box in a report, and don't
forget to write the equal sign before
=IIf(ctyp="OLD" or ctyp = "NEW","yes","no")

If the ctyp is the name of a text box in a report, change it to the field
name in the table.
 
Back
Top