Counting Null Values in Report

A

awach

How can I make this work in a report?

=DCount("*","[Contact Info]","[LinkField=LinkField]"

I had a previous suggestion to make a query and use it in the parent form
but that won't work. Any other ideas? Thanks!


Further Details:

I have a report with several subreports. The report looks like:

Customer Name
Contact Info*
Product Info*
Shipping Info*

with the * being the subreports.

I want to be able to count the number of records in each subreport
(including none) for the
customer on that page. The report and subreports are linked by a field
[LinkField], a autonumber assigned to each customer.

I tried doing DCount("*","[Contact Info]","[LinkField=LinkField]" in the
main report. This returns the count of all the records (without limiting to
the specified link field). I tried DCount("*", "[Contact
Info]","LinkField="Parent![LinkField]" in the subreport. That returns the
correct number so long as the count of records isn't zero. If the subreport
is null, it displays an Error message.

Is there another way I can do this? Please Help! :)
 
M

Marshall Barton

awach said:
How can I make this work in a report?

=DCount("*","[Contact Info]","[LinkField=LinkField]"

I had a previous suggestion to make a query and use it in the parent form
but that won't work. Any other ideas? Thanks!


Further Details:

I have a report with several subreports. The report looks like:

Customer Name
Contact Info*
Product Info*
Shipping Info*

with the * being the subreports.

I want to be able to count the number of records in each subreport
(including none) for the
customer on that page. The report and subreports are linked by a field
[LinkField], a autonumber assigned to each customer.

I tried doing DCount("*","[Contact Info]","[LinkField=LinkField]" in the
main report. This returns the count of all the records (without limiting to
the specified link field). I tried DCount("*", "[Contact
Info]","LinkField="Parent![LinkField]" in the subreport. That returns the
correct number so long as the count of records isn't zero. If the subreport
is null, it displays an Error message.


Each subreport needs to do its own count. Add a text box
named txtCount in each subreport's Report Footer section.
Set its control source to the expression =Count(*) You
can make the report footers or just the txtCount text boxes
invisible if you do not want to see them.

The main report can then display a subreport's count by
using a text in the main report section that contains the
subreport using the expression:
=IIf([Contact Info].Report.HasData, [Contact
Info].Report.txtCount, 0)
 

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