Report Footer Count

B

Brad M

I am trying to count the total records in a report footer using the following
function:
=Count([MK DB Name])

When there are records it seems to work fine. However, when there are no
records I want it to print "0". I tried an IIF statement using a nested
ISERROR but I got the same results. Any ideas how to craft the statement so
I can get rid of #error that is displayed?

Thanks
 
F

fredg

I am trying to count the total records in a report footer using the following
function:
=Count([MK DB Name])

When there are records it seems to work fine. However, when there are no
records I want it to print "0". I tried an IIF statement using a nested
ISERROR but I got the same results. Any ideas how to craft the statement so
I can get rid of #error that is displayed?

Thanks

Use the Report's OnNoData event.

Place a label over the control used to show the count.
Set the caption to 0
Make it Not Visible
Name it lblShowZero

Code the Report's OnNoData event:
[lblShowZero].Visible = True
[ControlUsedToShowCount].Visible = False

Why not just cancel the report if there are no records?
In the OnNoData Event:
MsgBox "There are no records to report on"
Cancel = True
 
Top