Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf statement in Report field 1

Status
Not open for further replies.

rperre

Programmer
Jan 25, 2005
39
US
Hello,

I have a report that displays Properties, Units and Tenants. I have succesfully grouped and the report looks nice. For my question lets say I have a property with 3 units and only 2 units are occupied by Tenants. Now when I open my report the first and last names of the tenants show up nicely and the other field (empty or vacant unit) shows up empty.

I want to use code to validate if the Tenant ID field is the number 0 (no tenant in the unit), and if it is, I want to put the word "VACANT" in the [First Name] field of the report.

I use this code in the source field and it will show the VACANT, but it gives an #error when the the expression is FALSE

=IIf([Tenant ID]=0,"VACANT",[First Name])

What do I do wrong?

Thank you,

Richard
 
Is the field name actually [First Name]? Also, make sure the name of the control is not the name of a field.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
aaargh, changing the name of the control was the solution, thank you very much.

It's always something smaller than I think!

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top