Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datediff from currentdate to the last 3 years 2

Status
Not open for further replies.

choochoowinn2009

Technical User
Feb 24, 2010
34
0
0
US
Hi,

How would you write in the select record to list all records from a date field to the last 3 years? should I use date diff from currentdate to ????

 
Do you want to go back to exactly 3 years ago, or the first of the month.

Exactly 3 years create a formula of
Date(Year(CurrentDate)-3,Month(CurrentDate),Day(CurrentDate))

For the first of the month use
Date(Year(CurrentDate)-3,Month(CurrentDate),1)

And then your record selection is
{Table.Datefield} >= {@3years formula)

The only major problem with the first option is if you ran the report on Feb 29 this year, you would try and calculate the 29th of Feb 3 years ago, and thats invalid as it's not a leap year.

Bruce Ferguson
 
I need to rephrase my question though: I have a datebilled column, and I need to show all the claims that were datebilled including that datebilled within the last three years. Does this make any sense?
 
Dateserial adapts for leap year, and doesn't error out:

Dateserial(Year(CurrentDate)-3,Month(CurrentDate),Day(CurrentDate))

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top