IIF and Sum

G

Guest

I am having trouble making the IIF stetment work with a
Sum on a report.

In a textbox I have this for a control source...
Sum(([TVisit]*[tax1]*0.01)+([TVisit]))

TVisit and Tax1 are controls in the reports detail.

When there are no records (null) in these controls, the
textbox displays '#Error' I want it to display '0'

I tried this...
=IIf(IsError(Sum(([TVisit]*[tax1]*0.01)+([TVisit]))),0,(Sum
(([TVisit]*[tax1]*0.01)+([TVisit]))))

But I still do not get a zero to display.

Tom
 
G

Gary Miller

Can I assume that if the TVisit is null, that the tax will
also be null? If so,...

IIf(IsNull([TVisit]),0,Sum(([TVisit]*[tax1]*0.01)+([TVisit])
))

If you do need to test both, you will need to add the second
IsNull check and decide if you are checking for AND or OR.
--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 

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