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

Date Part Issue 1

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
After developing in Crystal version 7.0 for years, I have finally took the plunge and upgraded to Crystal Reports 2011 version 14.0.4.738 RTM.

Opening one of my old reports (written in 7) and opening it in Crystal Reports 2011 version 14.0.4.738 I get the error message "A month number must be between 1 and 12"

The formula is
if day (CurrentDate) in 1 to 14 and Month (CurrentDate) <> 1 then

{CallLog.CallStatus} = "Closed" and
{Detail.AS_Account_Name} = "MyName"

and
{@DateClosed} in Date (Year (CurrentDate),Month (CurrentDate)-1 , 16) to Date (Year (CurrentDate),Month (CurrentDate) ,1 )-1

I think the issue is with this part of the formula:
Month (CurrentDate)-1

as if you take the month part of the current date (1) and subtract 1 from it you get 0 and we do not have any 0 months.

Apparently version 7 was smart enough to know that this is a date and when you subtract 1 from the month 1 you get 12. Surely version 14 is smarter than 7 but why is it throwing up the error in 14?

Lots of new stuff to learn in 14.

Thanks
Bennie


 
Change the Date() function to the DateSerial() function and it should work from there.

~Brian
 
That did the trick Brian, Thanks. Now to find all of these I may have done over the years....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top