Crystal Reports and Date Parameters

Recommended Posts

oktoberfest2 0

oktoberfest2 0

It appears that auto it has some problems passing in a date value to a crystal reports parameter. I'm wondering if someone has found a way around this.

Here is what I have:

Thank you

Dim$iDim$sReportNameDim$CRAppDim$CrystalReportDim$CRViewer1;Set Location of Template to Open$sReportName="C:\Report1.rpt";Create Application Object instance$CRApp=ObjCreate("CrystalRuntime.Application")If$CRApp=0ThenMsgBox(0,"Error","Could not create CrystalRuntime Object")ExitEndIf;Create a Report Object instance$CrystalReport=$CRApp.OpenReport($sReportName);Set Login Information_SetDataSource()If$CrystalReport=0ThenMsgBox(0,"Error","Could not open report: "&$sReportName)ExitEndIf;Create a Report Viewer Object instance$CRViewer1=ObjCreate("CrystalReports11.ActiveXReportViewer.1");#################################################;Pass in some parameters;#################################################;This works fine (Passing in a String)$CrystalReport.ParameterFields(1).AddCurrentValue("Passing in a String");This too works fine (Passing in a Number)$CrystalReport.ParameterFields(2).AddCurrentValue(100);or even this$CrystalReport.ParameterFields(2).AddCurrentValue(number("100"));Can't get this part to work (Passing in a Date)$CrystalReport.ParameterFields(3).AddCurrentValue("2007-09-01");Even grabbing the first defaultvalue from Crystal does not work$CrystalReport.ParameterFields(3).AddCurrentValue($CrystalReport.ParameterFields(3).getnthdefaultvalue(1))

Share this post

Link to post

Share on other sites

Freedom1 0

Freedom1 0

Well, I hope an answer appears soon. I've been wanting to do an AutoIt to CR interface for some time now. I thought about locating a VB dll that would convert a string to date that could be used within AutoIt. But then again, if someone were knowlegeable on how dates were stored in VB, they could probably create a small conversion routine in AutoIt.