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!

Dsum and dates

Status
Not open for further replies.

FoxGolfer

Programmer
Jul 30, 2002
100
US
I'm trying to sum invoices for a specific date range. I've started with:
= Dsum("Paid_date","Invoices", .....) and many variations for the criteria, all with no success. What I want is every thing between 1/1/2005 and 12/31/2005. I tried "Having [Paid_date] between #1/1/2005# and #12/31/2005#" as the criteria; and variations with "'s and &'s with no luck. I guess I just don't get the way to enter the criteria correctly. Any help?
Thanks,
Tom
 
How about?

[Paid_date] >= 1/1/2005 And [Paid_date] <= 12/31/2005



-Pete
 
Nope, didn't do it. I got the total of EVERYTHING, not just for 2005.
Here's what I tried:
=DSum("Paid_amt","Invoices",[Paid_date]>=1/1/2005 And [Paid_date]<=12/31/2005)
 
For litterals, you need #

[tt]=DSum("Paid_amt","Invoices",[Paid_date]>=#1/1/2005# And [Paid_date]<=#12/31/2005#")[/tt]

For a year, I suppose you could also do something like

[tt]=DSum("Paid_amt","Invoices","year([Paid_date])=2005")[/tt]

Roy-Vidar
 
=DSum("Paid_amt","Invoices","[Paid_date]>=#1/1/2005# And [Paid_date]<=#12/31/2005#")



-Pete
 
Thanks guys, they BOTH worked fine. It's me, can't figure out how to place literals in code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top