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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report showing date 1 month less than current date

Status
Not open for further replies.

tezzyr

Programmer
Oct 6, 2006
21
GB
hi,
probably a really easy one for you guys, but im a newbie so please forgive my ignorance!
I'm trying to setup a record selection filter so that when my report is run, the only values shown on the report are ones that contain a date which is 1 month less than the date the report is viewed, i.e {date}<(currentdate - 1 month)
I'm using crXI on an sql server db.
thanks!
 
sorry, I meant {date}>(currentdate - 2 months) as i dont want any records displayed that are more than 2 months old.
 
It sounds like you want data from the last 2 full months.
So today being Nov 21, 2006, you'd want data from all of September and October of 2006.
Is this correct?
If so then try this:
Code:
{Date} in DateSerial(Year(CurrentDate), Month(CurrentDate)-2,1) to DateSerial(Year(CurrentDate), Month(CurrentDate),1-1)

Bob Suruncle
 
Calendar month or 30-day interval? {date} =< (currentdate - 30) works by days. Otherwise do a formula field
Code:
DateDiff("m", {date}, currentdate)
Test it for being more than one. Maybe display it first to confirm it does what you want.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top