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    
post Oct 11 2018, 04:15 PM

Posts: 620
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.
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!

Go to the top of the page
post Oct 11 2018, 04:47 PM

Posts: 3,136
Joined: 27-February 09

Use Date() to get the current date, then ...

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
post Oct 11 2018, 10:54 PM

Posts: 620
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
post Oct 12 2018, 08:20 AM

UtterAccess VIP
Posts: 9,673
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)


"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    25th June 2019 - 04:50 PM