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

Crystal XI Month Number must be between 1 and 12

Status
Not open for further replies.

dixie617

Programmer
Jun 8, 2005
62
US
Need a little help, I have been searching for a couple of hours and cannot find anything even close to this problem. I have created a cross tab report in CRystal XI, for three months back, a set of data for each month. I used simple formulas to determine the month Name for the column header, but getting an error on month 3 date because 3 -3 = 0 which I want to be December. This is what is giving me the error

INitial formula to figure month number:
(Month(CurrentDate)) -3
The error comes when I pass to this formula to determine the month name: MonthName({@Month3Date})

Any help would be greatly appreciated. Thanks
 
You can use the following:

month(dateadd("m",-3,currentdate))

Dateadd successfully calculates across years. You can also use dateserial in this way:

month(dateserial(year(currentdate),month(currentdate)-3,1))

-LB
 
Thank you so much, I knew it was something easy like that, but I just could not find it. Worked great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top