#Error on Count(*)

C

christyh

Report contains field where the control source is =Count(*). When there are
no records, #Error is returned. Is there a way to have "no records found"
appear instead of this "#error"? Thx.
 
M

Michael H

Hi.

There may be a better way, but here's how I got this to work:

Add a new TextBox with the Control Source set to =Count(*). Name it
"txtCount2" (or similar), and make it invisible. Now change the Control
Source of your original TextBox to:
=IIf(IsError([txtCount2]),"",Count(*))

-Michael
 
C

christyh

Thank you for your input. I also found that this seems to work:
=IIf([HasData],Count([FIELDName]),"No records found")



Michael H said:
Hi.

There may be a better way, but here's how I got this to work:

Add a new TextBox with the Control Source set to =Count(*). Name it
"txtCount2" (or similar), and make it invisible. Now change the Control
Source of your original TextBox to:
=IIf(IsError([txtCount2]),"",Count(*))

-Michael



christyh said:
Report contains field where the control source is =Count(*). When there are
no records, #Error is returned. Is there a way to have "no records found"
appear instead of this "#error"? Thx.
 
Top