query returns no records, need to convert to "0"

B

bman33

my query returns no records, but i need it to be a zero value because that
answer is used in a report that totals several items. Without a number (0),
the totals won't work.
 
A

Allen Browne

If the report is based on a query that returns no records, and you have a
text box in the report footer that is bound to an expression like this:
=Sum([Amount])
it displays #Error.

If you want to show a zero instead, change the expression to:
=IIf([Report].[HasData], Sum([Amount]), 0)

More information:
Avoid #Error in form/report with no records
at:
http://allenbrowne.com/RecordCountError.html
 

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