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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DSum in Report

Status
Not open for further replies.

ccoop61

IS-IT--Management
Sep 10, 2003
1
US
I have created a report that runs off of a crosstab query and the user selects the criteria to run the query through a form. The report is displaying the correct information everywhere except in the DSums. Here it is pulling the data from the crosstab query as if it was run without any criteria being selected. Any ideas? Thanks.
 
Hi,

As the DSum is an external function, it doesn't use any of the where clauses and group by's in the SQL. Your options therefore are to use the SQL Sum aggregate function in the SQL, or add extra criteria to the DSum to allow it to get the correct data.
My preference would be for the Sum function, as calling VBA functions from SQL slows down query execution quite significantly.

John
 
I have created hundreds of reports and never had to use a DSum(). If your DSum() has the same recordsource/domain as your report then replace the DSum() with Sum(). If we knew more about your report fields and your DSum() syntax, we could provide more details.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top