Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCount Problem with Parameter Query

Status
Not open for further replies.

LindaLou

Technical User
Feb 3, 2001
16
0
0
US
I have a summary report based on a form. The report uses a Dcount function as the record source on MANY controls. The report is based on a query and that same query is referenced in the Dcount expression. Because I will need to run this report with quarterly summaries I decided to change it to a parameter query in which the user can just enter the dates for the desired quarter. Problem is now that the report is based on the parameter query the controls with Dcount functions only return #ERROR where before they returned counts. I have made the new parameter query with the same Name as the old so the reference in the DCount expression is still valid. The query itself will return all the individual record data for the selected quarter, but when I try to run the summary report I no longer get any of the DCount summary fields to populate. Can I NOT use a DCount function with a parameter query? If that is the problem how can I run a quarterly report without actually creating a separate query and report for each quarter in which I have to change all the DCount expressions to reflect the new query names?

(This is my first experience with DCount and I am using it to tabulate a LARGE number of Option group boxes for summary numbers.)

Thanks for any help you can provide.
 
Did some further research on old posts and found a solution on the Reports forum. Instead of using DCount to sum my option group records I can use an IIF statement instead. So, for example control sources with DCount expressions such as this:

=DCount("Function","qryAudits","Function='1'")

I have replaced with an IIF statement like this:

=Sum(IIf([Function]="1",1,0))

This counts each of my option group results and still allows me to base the report on a parameter query which allows the user to enter the Year and Quarter criteria into the query.

Now if I can just figure a way to print my summary report without having it repeat for each record in the query. Any other ideas or optional solutions are welcome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top