This year and last year.

travismp

Registered User.
Local time
Today, 16:41
Joined
Oct 15, 2001
Messages
386
I need to see all values in a date field [SalesDate] for all of this year and all of the previous year.

I know this will show me all of the previous year
Code:
Year([SalesDate]) = Year(Date()) - 1

But how do I show all of this year and all of he previous year as well? thanks.
 
in a query use The BEWTEEN AND Keywords


e.g. Year(YourDate) BETWEEN Year(Date()) AND Year(Date()) - 1
 
Thank you. I went to add that and I think this will be a little more complicated than I thought. Here is my current SQL vlaue for my query

Code:
Switch(([AD_DDate]>=#1/1/2007# And [AD_ADate]>=#1/1/2007#) Or [Approved]=-1,'PASS') AS PASS,

How could I change these two values from 1/1/2007 to current year and previeous year?
 
Hi -
Code:
Pass: IIf(Year([YourDate]) Between Year(Date()) And Year(Date())-1,"Pass","")

HTH - Bob
 
I'd actually recommend

WHERE [SalesDate] >= DateSerial(Year(Date()) - 1, 1, 1)

If you have future dates too that you needed to exclude then you'd need to add to that
WHERE [SalesDate] >= DateSerial(Year(Date()) - 1, 1, 1) AND [SalesDate] < DateSerial(Year(Date()) + 1, 1, 1)

Assuming we're talking previous calendar year and that last year was 2008 (unless I've been dreaming and it was actually 2007 ;-)

Cheers.
 

Users who are viewing this thread

Back
Top Bottom