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

year-to-date totals in query or report

Status
Not open for further replies.

cochise

Technical User
Mar 27, 2001
171
US
I have a report that is based on a query that calculates sales, percent total sales, # invoices, % invoices, etc... by city. The report right now calculates the data for a month period. I would like that same report to have year to date values for various fields. Does anyone know how I can do this or could someone point me to a good source?
 
you could make a separate SUB report at the bottom of the main report that looked a new query which was just year to date totals.
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
I actually wanted to include it in my main report, not a sub report.
 
Use the DSUM function. Place it in the Control Source property. Here is an example.

=DSum("[Hours]","tHistorySummary","[year] = " & [iYear] & " and [CustNo] ='" & [CustomerNo] & "'")

This example sums up the hours for a customer in a year. Remove the customer criteria and you will get the totals hours for all.

I use this in a report and it works just fine. It will work in a form just the same. Just remember, it is just like running an added query in the report. Depending upon the number of records it will add time to the report execution.

Larry DeMaio
SDC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top