Full Version: #Error message
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
sging1
I am putting a report together that simply gives a total of how many records the query generates. The problem is when there are no records I get #Error in the control. Is there a way of getting zero to appear when there aren’t any records to count.

=Count([clientid])

Thanks.
Rammy
Try =IIf(IsError(Count([clientid]),0,Count([clientid])
sging1
Thanks fr the reply. I'm getting an error with that one something about brackets.

Stephen
Rammy
I think it should be this when i've checked it.

=IIf(IsError(Count([clientid])),0,(Count([clientID])))

The brackets always give me trouble.

Hope it works this time!
sging1
Thanks it took it this time but it still shows #Error when there are no records. Thanks for the help.

Stephen
Wales
Rammy
I think i've hopefully found the answer:

=IIf([clientID] Is Null,0,Count([clientid]))


If not then i've found a way around it which will make your count control's visible property set to No, therefore making it invisible. You will need to put this code in the report's open event.


If DCount("clientid", "YOURTABLENAME") = 0 Then
YOURCOUNTCONTROL.Visible = False
End If

Give it a try and if it still doesn't work let me know.

Edited by: Rammy on Tue Sep 6 7:39:48 EDT 2005.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.