Announcements
 Crystal Reports Forum : General Information : Announcements
Message Icon Topic: a month number must be between 1 and 12 Post Reply Post New Topic
Author Message
kevinp70
Newbie
Newbie


Joined: 25 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote kevinp70 Replybullet Topic: a month number must be between 1 and 12
    Posted: 25 Jan 2013 at 10:23am
Hello... I have a "monthly" report that works perfectly when ran; however, it will not run for the month of December of any year. I get the error " month number must be between 1 and 12".. the formula editor then opens with the code. Any suggestions why only for Dec of any year it fails with this message? Thank You!

{u_case.cs_date_filed} in (Date (Year({u_case.cs_date_filed}), Month({u_case.cs_date_filed})+1, 1) -4) to (Date(Year({u_case.cs_date_filed}), Month({u_case.cs_date_filed})+1 , 1) -1)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 28 Jan 2013 at 6:04am
That's because the month for December is 12 and you're adding 1 to it to make 13, which is not a valid month.
 
Try something like this:
(
(Month({ucase.cs_date_filed}) < 12 and 
 {u_case.cs_date_filed} in 
 (Date (Year({u_case.cs_date_filed}), Month({u_case.cs_date_filed})+1, 1) -4) to 
 (Date(Year({u_case.cs_date_filed}), Month({u_case.cs_date_filed})+1 , 1) -1)
OR
(Month({ucase.cs_date_filed) = 12 and
 {ucase.cs_date_filed) in
 (Date (Year({ucase.cs_date_filed}) + 1, 1, 1) - 4) to
 (Date(Year({ucase.cs_date_filed}) + 1, 1, 1) - 1))
)
 
Note where I've put the red parentheses - those are required in order for this to work correctly.
 
-Dell
IP IP Logged
kevinp70
Newbie
Newbie


Joined: 25 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote kevinp70 Replybullet Posted: 28 Jan 2013 at 11:29am
Genius my friend... thank you !
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.