Count

  • Thread starter Thread starter Jini
  • Start date Start date
J

Jini

I am using a count. If there is no records, I get an error
message #error instead of 0. Is there a way to make the
count show 0 if no records were found to count?
 
Hi:

Use this function in your report's [Fieldname] control source or query
[Fieldname] criteria

IIF(Count([Fieldname])is null,0,Count([Fieldname]))
 
I don't think this will work.
Try:
=IIf([HasData],Count(*),0)

--
Duane Hookom
MS Access MVP


Bill Crawford said:
Hi:

Use this function in your report's [Fieldname] control source or query
[Fieldname] criteria

IIF(Count([Fieldname])is null,0,Count([Fieldname]))

Jini said:
I am using a count. If there is no records, I get an error
message #error instead of 0. Is there a way to make the
count show 0 if no records were found to count?
 
Jini said:
I am using a count. If there is no records, I get an error
message #error instead of 0. Is there a way to make the
count show 0 if no records were found to count?

How are you using the Count? If a report has no records,
then there is nothing in the report and a count doesn't make
much sense.

If the count is in a subreport and you want to display the
count in the n=main report then use an expression like:

=IIf(subreport.Report.HasData, subreport.Report.txtcount, 0)
 
Back
Top