#error in report totals driving you mad!?

V

Virage

It has been driving me mad too, but now there is a very nice way to
get around it.

1. You may get the "#error" instead of 0 or nothing, when you have
calculated fields on the report such as:
=sum(salary)
=count(months)

2. This is cuased by the fact that your recordset may not be returning
any data and thus there is no way Access can tell what to do the
caluclation on.

3. Foreget it about usign IIF: it won't work as Access does not know
how to evaluate the value of the field is does not understand:
iif(isNull or somefield <> "" etc. will not work.

4. To get around it, cancel the report display when there is no data:

Access has an event attached to the report called On No Data. You can
cancel this report when there is no data or even display a nice
message before you cancel it: try this:

Private Sub Report_NoData(Cancel As Integer)

MsgBox "Report returned no data.", vbInformation, "ATD - Reports"
Cancel = True

End Sub

------------------------
Bartosh Michalik
Senior IT Consultant
PRISM Inc.
Victoria BC
Web: http://www.prism-itc.com
"Development of database, e-commerce and Web solutions for today's
market and today's budget!"
 
D

Duane Hookom

You can also use expressions like:
=IIf([HasData], sum(salary),0)
=IIf([HasData],count(months),0)
 

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