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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iff then statement

Status
Not open for further replies.

bethabernathy

Programmer
Jul 13, 2001
254
MX
Hi - I am having trouble getting an Iff, then statement to work. I am trying to prepare a receipt report for ski products purchased (i.e. lift tickets, season passes, etc.). I have 3 products on the receipt report as the following fields:

DESC (this field = season passes)
Expr5 (this field = lockers)
Expr4 (this field = other products)

If someone purchases a "Expr5" but not a "DESC", I want "Expr5" to display first and "DESC" not to display at all, since there is no record. So, my Iff, then statement is:

=IIf([DESC]=" ",[Expr5],[DESC])

but... it isn't working. I must have it backwards or something. My brain is fryed here today. beth@integratedresourcemgmt.com
 
Does DESC have a 1-character string containing a space, when no DESC was purchased? Your code implies that it does, and it should work if so.

More typically, though, DESC would be Null in such a situation. In that case, you should use:
IIf(IsNull([DESC]), [Expr5], [DESC]) Rick Sprague
 
Hi - I think there is something with the data, as I got this to work using a complex work around. But, I'd rather use what you suggested, but am getting a syntax error, saying "extra ) in query" Can you help me get it right.

Thanks, so much. Beth
beth@integratedresourcemgmt.com
 
Please check your typing. I suspect you left out a "(" somewhere, perhaps after IsNull. Either that, or you typed an extra ")" somewhere, perhaps at the end. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top