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
> Get Prior 12 Months Without Including Current Month, Access 2010    
 
   
Jrayhan
post Oct 11 2018, 04:15 PM
Post#1



Posts: 617
Joined: 29-November 12



Hi UA,
I am kinda stuck here with a process I am trying to build. I am trying to allow user to run a report based on Prior 12 months.
But I do not want to include current incompleted months data.
So, If I run a report on 6/10/2018, I would like to see the data from 6/1/2017 to 5/31/2018. I do not want to include those first 10 days from the current month.

This is what is have so far.
CODE
Between DateAdd("yyyy",-1,DateSerial(Year(#6/10/2018#),Month(#6/10/2018#)+1,1)) And DateSerial(Year(#6/10/2018#),Month(#6/10/2018#)-1,31)


Any help would be much appreciated!

Thanks
Ray
Go to the top of the page
 
MadPiet
post Oct 11 2018, 04:47 PM
Post#2



Posts: 2,508
Joined: 27-February 09



Use Date() to get the current date, then ...
DateSerial(Year(Date()),Month(Date()),1)

or similar...
Then just do a DATEADD to go back x number of cycles (year, month, day.. .whatever)
Go to the top of the page
 
Jrayhan
post Oct 11 2018, 10:54 PM
Post#3



Posts: 617
Joined: 29-November 12



Thanks for the replay, Madpiet . I have used #6/10/2018# as an example here. Initially I have used date() function as you suggested. I will try it again tomorrow.
Go to the top of the page
 
RJD
post Oct 12 2018, 08:20 AM
Post#4


UtterAccess VIP
Posts: 8,971
Joined: 25-October 10
From: Gulf South USA


Hi: PMFJI, but it looks like this should work for you ...

Between DateSerial(Year(Date())-1,Month(Date()),1) And DateSerial(Year(Date()),Month(Date()),0)

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    23rd October 2018 - 11:55 PM