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

CRAXDRT A month number must be between 1 and 12

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
US
Using Oracle 10, Coldfusion, CR 8.5 on desktop and CR 11.5 on server.

Keep getting this error when I press submit to run report, "A month number must be between 1 and 12". I've changed the parameters in the report to use DateSerial, but still doesn't work, keep getting the same error.

Here is the form code used to submit the report -

[
<cfimport taglib="../customtag" prefix="xxxx">
<xxxx:layout>
<h2>Mileage By Employee Report</h2>

<cfif NOT isDefined("form.filter")>
<form name="ReportFilter" method="post" onsubmit="return checkForm();">
<cfinclude template="report_filter_dates.cfm">
<input type="hidden" name="filter" value="Y">
<button type="submit">Submit</button>
</form>
<cfelse>
<script src="#application.libSrc#windows.js" type="text/javascript"></script>
<cfparam name="StartDate" type="date" default="#now()#">
<cfparam name="EndDate" type="date" default="#Now()#">
<CFSET USERNAME = '#session.objUser.getProp('user_name')##RAND()#'>
<CFSET ReportPath = "
<cfset ReportName = "MileageByEmployee.rpt">
<!--- NO STORED PROC CALLED FOR THIS REPORT --->
<CFOUTPUT>
<form action="#ReportPath#" method="POST" name="parmform">
<INPUT NAME="P1" VALUE="#CreateDate(year(StartDate), month(StartDate), day(StartDate))#" TYPE="Hidden">
<INPUT NAME="P2" VALUE="#CreateDate(year(EndDate), month(EndDate), day(EndDate))#" TYPE="Hidden">
<INPUT NAME="ReportName" VALUE="#ReportName#" TYPE="Hidden">
</FORM>
</CFOUTPUT>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function openreportwindow( parmform ) {
window.open( '', 'reportviewerwindow', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes')
parmform.target = "reportviewerwindow";
parmform.submit();
}

openreportwindow(document.parmform);
history.go(-1);
//-->
</SCRIPT>
</cfif>
</xxxx:layout>
]

Here is the code for the calendar -

[<table>
<tr>
<td valign="middle" width="120"><strong>Start Date:</strong></td>
<td valign="top"><input type="text" name="StartDate" size="10" maxlength="10" onblur="isValidDate(this.value,this);"><a href="javascript:cal_1.popup();"><img src="/images/calendar.gif" border="0" alt="Click Here to Pick up the date"></a></td>
</tr>
<tr>
<td valign="middle" width="120"><strong>End Date:</strong></td>
<td valign="middle"><input type="text" name="EndDate" size="10" maxlength="10" onblur="isValidDate(this.value,EndDate);"><a href="javascript:cal_2.popup();"><img src="/images/calendar.gif" border="0" alt="Click Here to Pick up the date"></a></td>
</tr>
</table>
<cfoutput>
<script language="javascript" src="#application.libSrc#calendar.js" type="text/javascript"></script>
<script src="#application.libSrc#customValidator.js" type="text/javascript"></script>
</cfoutput>
<script language="JavaScript">
var cal_1 = new calendar2(document.forms['ReportFilter'].elements['StartDate']);
var cal_2 = new calendar2(document.forms['ReportFilter'].elements['EndDate']);
</script>
]

Any ideas on what I'm doing wrong? Upgrading CR 8.5 to 11.5 is not an option.

Thanks,
Sherry
 
I forgot to mention that the dates being passed, startdate and enddate are being used as parameters on the crystal reports.

Thanks,
Sherry
 
szeiss,

I am not 100% sure, but perhaps worth posting in the ColdFusion forum ( forum232 ). I *think* it is perhaps getting the Month() and Day() mixed up, but I have never written in CF to be able to truly debug the code you have provided (can read it well enough to get the gist of it though).

I do know that I when I have received a similar error within Crystal Reports itself, it has been the order of the day and month values in the date (mm/dd/yyyy vs dd/mm/yyyy has even got me once or twice).

Sorry not of more assistance on this, hopefully this post helps though.

Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
I agree with Mike that it probably means you need to add explicit date formatting in your code.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top