Getting a Total by Month and Year

P

Paul Fenton

Is there a way to use the DSUM function to get a total based on a
specific month and year? Say I want to see total sales for January of
2004 in a table that has a "Sold" field (currency) and a "DateSold"
date field for each record.

If not DSUM, then how would I do this?


Paul Fenton
(e-mail address removed)
 
K

Ken Snell [MVP]

This is a hardcoded way to do what you seek as a DSum function:

DSum("FieldBeingTotaled", "NameOfTable", "MonthField=1 And YearField=2004")
 
K

Ken Snell [MVP]

Or, using a single date field:

DSum("FieldBeingTotaled", "NameOfTable", "Month([DateField])=1 And
Year([DateField])=2004")
 
V

Van T. Dinh

Try something like:

DSum("Sold", "YourTable",
"([DateSold] >= #01/01/2004#) AND ([DateSold] < #02/01/2004#)")

(type as one line.)
 

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