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!

need conditional output of a column based on contents 1

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
I've got a column (text box) 'bid' that prints out a currency amount. If the amount is $0.00, I wish the output to be blank. I changed the Control Source from 'bid' to =iif([bid] = 0, "", [bid]) but only get errors. My 3rd party references don't cover this technique.

-with thanks, Mike Scott
 
Mike,

You can't use functions like IIf in a bound text box. Try adding a new text box and set your IIf statement as its control source. That should work.....
 
Thanks Cosmo.
Yes, I just found this solution in an earlier post "Troubleshoot IIf statement". It only works for one of two cases I have. The other case is a little more complicated. The field is extracted with:
SELECT [guest].[sortname] & "(" [guest].
& ")" AS sortname FROM ...

My report uses the Control Source as [sortname]. If the record is blank, I get '()' on my report. I tried:
=iif([sortname] = "()", "", [sortname])

I still get the empty parenthesis on blank records.
Any ideas? -thanks
 
See if this makes sense...

Leave your [sortname] field alone. Add an unbound text box that should have something like this as its control source:
Code:
=IIf([sortname] Is Null,"",[sortname] & "(" & [table] & ")")
This should get rid of the extra parens, only the records with a sortname will have them.....
 
Change not necessary -my mistake. The dreaded "invisible space" strikes again. My select actually returns " ()" on an empty record (a SPACE preceeds parenthesis). Sorry for the wasted keystrokes. (no doubt your suggestion would have worked, and was star-worthy).
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top