View Full Version : Put a blank if zero field in report??


bsnapool
01-24-2008, 02:24 AM
Hi All,

Tried doing this within query, my current expression is...

Cost Difference: IIf(Len([SumOfBudget Cost£] & "")=0,[SumOfActual Cost],([SumOfActual Cost]-[SumOfBudget Cost£]))

When i replace the zero with a "-" or "blank" then it messes up the formatting of the percentage. Is there a way to do this in vba. Something like if zero then make blank??

Any advice would be appreciated.

Rich
01-24-2008, 03:30 AM
If you want it to be Null then why put a Zero in to start with?

bsnapool
01-24-2008, 04:01 AM
If you want it to be Null then why put a Zero in to start with?

I put a blank to start with but was messing up my formatting.

Brianwarnock
01-24-2008, 04:18 AM
The code does not seem to tie in with the thread heading.

If a field is zeo and you want to display a blank then

IIF(fild=0," ",whatever) should work

Brian

bsnapool
01-24-2008, 04:23 AM
I tried this, but comes up with an error#??

bsnapool
01-24-2008, 04:34 AM
School bot error, was using the actual field!! Used a testbox and working.

Rich
01-24-2008, 04:44 AM
I put a blank to start with but was messing up my formatting.

How did it mess up the formatting?

bsnapool
01-24-2008, 05:14 AM
Well put the format as percentage, when added "", it would then take the percentage formatting off.

rsmonkey
01-24-2008, 05:32 AM
depending whether this is a one time thing or abit of desing you want to implement and Update-Where statement should work fine... just whack it in your form code under a button or create a physical query in the query builder! whatever way you swing!