Friday, February 24, 2012

Date expression in Access

I'm pretty new to this whole "programming" game. The date field I'm using is [date]. I need to create two queries. One will pull all records year-to-date this year. The other should pull all records year-to-date last year. I'm sure there is an expression that accomplishes this, without having to type in parameters each time I execute the query. Examples, please.datediff(yy, [YourDateValue], getdate())

...will give the difference in the years between your data value and the current date.

Value 0 means YourDateValue is current year-to-date.
Value 1 means YourDateValue is prior year-to-date.
.
.
.
etc

blindman

No comments:

Post a Comment