DCount Report Question

K

knowshowrosegrows

I have the following code in the ControlSource Property of a text box in a
report.

=DCount("[RecordID]","[Denial Specific
Info]","[First_Level_Appeal_Determinations]='Denied'")

My question - I have five total test records in my [Denial Specific Info]
table. Four are granted and one is denied. Why, when I run the code do I
get the correct DCount in the text box but I get the text box duplicated 5
times
down the page? --
Thanks
 
R

Rick Brandt

knowshowrosegrows said:
I have the following code in the ControlSource Property of a text box
in a report.

=DCount("[RecordID]","[Denial Specific
Info]","[First_Level_Appeal_Determinations]='Denied'")

My question - I have five total test records in my [Denial Specific
Info] table. Four are granted and one is denied. Why, when I run
the code do I get the correct DCount in the text box but I get the
text box duplicated 5 times
down the page? --
Thanks

Because you put the control in a report section that repeats five times.
That is determined by the data of your report's RecordSource and how you
have set the report grouping. If you have this in the detail section and
the report's RecordSource has five records, then you will get five
instances.

If your report is based on the [Denial Specific Info] table then you likely
don't need to use DCount() at all. The domain aggregate functions (all that
start with "D") are typically used to pull data from "some other" query or
table than the one your report or form is using. In your case report you
should be able to group by the [Denial Specific Info] field and in that
group header or footer just use Count(*).
 
O

Ofer Cohen

If the Text box located in the detail section, and the report recrd source
include more then one record, then the text box will apear as many time as
the amount of the records.

if you want it to display only once, move it to the report header or footer

Also, if it's located in the detail section, it will perform the DCount 5
times, which mean longer time to load the report
 

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