UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Dateadd For Sales 13 Months Previous, Access 2010    
 
   
crabbeng
post Jun 4 2019, 11:18 AM
Post#1



Posts: 13
Joined: 6-March 14



I use the following as a "where criteria" in a query

Year(Date())*12+DatePart("m",Date())-11

This gives me all the sales for last July, 11 months ago

I use
Year(Date())*12+DatePart("m",Date())
To give all the sales last June, 12 Months ago

What I'm asked for now is the sales for last May, 13 months ago, but I'm absolutely befuddled.
Any help would be greatly appreciated
Go to the top of the page
 
MadPiet
post Jun 4 2019, 11:35 AM
Post#2



Posts: 3,358
Joined: 27-February 09



Use DATEADD() one of the arguments is the date you're adding to (so use DATE()) and the other is the number of units, and the last is the unit size
Go to the top of the page
 
gemmathehusky
post Jun 4 2019, 11:59 AM
Post#3


UtterAccess VIP
Posts: 4,725
Joined: 5-June 07
From: UK


yes - you can use this sort of syntax

fromdate = dateadd(todate, months, -13)


then you can use simply

between fromdate and todate in your query.

--------------------
Dave (Male)

(Gemma was my dog)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    14th November 2019 - 05:08 PM