Help get percentage to show

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.
 
J

John Spencer MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top