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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf and Nz problem

Status
Not open for further replies.

dixxy

Technical User
Mar 4, 2003
220
CA
I have a report with a sub subreport . Then subreport is there to calculate a certain total.

then on the main report I use the value from that subreport and display it as a total in a textbox.

The problem I have is that if that sub report does not have any records in it, the text box will show #Error, so I am trying to make it display o when null and the value if there is reocords in the subreport with this;
Code:
=IIf(IsNull([qreAccPricing]![SumOfPrice]),0)
this will show 0 all the time
Code:
=IIf(IsNull([qreAccPricing]![SumOfPrice]),0,([qreAccPricing]![SumOfPrice]))
this will show the value of the subreport, but will show #Error when the subreport is empty..

I have tried using Nz in the formula in different ways, but i get much the same results...

Any ideas...


Thanks,

Sylvain
 
Have you tried this

=Nz([qreAccPricing]![SumOfPrice],0)

HTH
Mike

[penguin] Dooobie...Doobie......Dooo
 
Mike,

it will give me #Error if there is nothing in the subreport, and it will retrun the value if there is a record in the subreport

Thanks,

Sylvain
 
You can try:
=IIf(srptMySub!Report.HasData, srptMySub!Report!SumOfPrice,0)

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top