Oct 25 2007, 11:25 AM
I have a statistics report that shows a selected time frame (usually a weeks worth of numbers) along with a Year-to-Date time frame. Is it possible to have a query calculate and create a new field that has the beginning of each year show, for this year, 1/01/2007 and then for next year show 1/01/2008 and so on, without any user intervention. This new year field must show this beginning year date conistently the entire year.
Oct 25 2007, 11:32 AM
Yes it is possible.
The first date of current year:
DateSerial(Year(Date()), 1, 1)
The first date of next year:
DateSerial(Year(Date())+1, 1, 1)
For more info see:
Functions for calculating and for displaying Date/Time values in Access
Oct 25 2007, 12:14 PM
Thanks for looking at this. I believe that the first piece of code will do the trick. I just need to be able to display 1/01/"currentyear" and this should do that for this year and then when next year rolls around it looks like it will show that date too, and so on. I was looking for something that would calculate this data without needing user intervention and I believe you have answered that.
Thank you again.