Help get percentage to show

  • Thread starter Thread starter Jill
  • Start date Start date
J

Jill

In my query, I am performing the following calculation. Because often times
the field [IwoutP] is zero, I had to write the calculation as follows.

Realization: IIf([IwoutP]=0,"",([IwoutP]/[InvAmount]))

The challenge is that although I have the properties set to percent I can't
get it to show. I guess it is in conflict because of the first part of my
calculation BUT, I do not know how to fix it.
 
Since one of the possible return values is a zero-length string and the other
is a number, Access is forced to treat both as strings. Try using Null as the
second argument. If you do then Access will use the variant type to hold the
value - and variant can hold null or a number (or any other type of data).

Realization: IIf([IwoutP]=0,Null,([IwoutP]/[InvAmount]))

You could also return zero if you wished.

Realization: IIf([IwoutP]=0,0,([IwoutP]/[InvAmount]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top