YTD for previous years

mrscoe

New member
Local time
Today, 13:10
Joined
Oct 7, 2013
Messages
2
I am fairly new to access, so please be patient with me : )

I am trying to create an expression to pull data from 2011 to present date. I need the data for 2011 to only reflect 1/1/11 through 10/7/11 (today's date in 2011). I need the same for 2012 and 2013.

I don't want to have to enter dates each time I run this, therefore, a formula would be preferred rather than hard numbers.

Thanks in advance for any help!!!

Jessica
 
how about
Format(YourDateField, "MMDD")
and put a where clause:
Between "0101" and Format(Date(), "MMDD")
 
I assume that you are going to specify the start date value as constant like #01-01-2011# in the criteria row in the Query.

The second expression for the enddate you may use the following expression:

dateadd("yyyy",Inputbox("Year +/-"),date())

While running the query a msgbox will appear with the text in quotes (Year +/-) asking for value to complete the dateadd() function.

Enter -2 and press enter. This will subtract 2 years from current date i.e. if today is 10-07-2013 then subtracting -2 from year will give you 10-07-2011.

enter -1 to get 10-07-2012

enter 0 to take current date.
 

Users who are viewing this thread

Back
Top Bottom