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!

If no data, I want zeros instead of #ERROR# 1

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
I have access 2000 and I want the report to show all the number fields as zero instead of ERROR if there is no data to report. Can this be done?

Thanks,

Dawn

 
Dawn, in the underlying table, if the field is Number, you can set the Default value to 0. That should take care of the problem. Post back if it doesn't and we'll look at the Nz function.

Paul
 
Thank you but that is only going to work if there are records with no amount entered. But this is a report with a bunch of calculated fields and their is no underlying data in the query for a particular customer, so all the calculations come up ERROR. But, no data means that the customer balance is zero (no records means no outstanding invoices) so I want the report to show zeros.

Make Sense?

Dawn

 
You need to use expressions like:
=IIf(HasData,Sum(NumField),0)
If this doesn't help, reply with some of the control sources of your text boxes.


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
where do I use that Duane? In the OnNoData event? For each field that I want to show zero?

Thanks,

Dawn

P.S. here is just one of the text boxes...

=([OTotal]-Nz([OPayment]))

 
Use this in the control source:
=IIf(HasData, [OTotal]-Nz([OPayment],0),0)
I find it good practice to always have 2 arguments in every Nz() function.

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