I am trying to pass a parameter to a Crystal Report from a VB.Net app. Based on the parameter value, it will either print detail lines or sub-total/summary lines.
I created a Parameter Field in the CR IDE. In the "Section Expert", I selected "Detail" and clicked on the "Suppress (No drill-down) checkbox. I then clicked on the Formula Editor icon next to it to enter the Formula Editor. I double-clicked on the Parameter Field and entered the following line for the formula:
{?ReportType} = "D"
My VB Code looks like this:
My app is bombing on the highlighted line of code giving me the following error:Code:Public Function CreateSettlementReport() As Exception Try Dim crSettlement As New rptSettlement Dim diskOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions() Dim exportOpts As ExportOptions = New ExportOptions() crSettlement.SetParameterValue("@ReportType", strReportType) crSettlement.SetDataSource(DS) exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat exportOpts.ExportDestinationType = ExportDestinationType.DiskFile strSettlementReport = "\Settlement" & strReportDate & ".PDF" diskOpts.DiskFileName = strPath & strSettlementReport exportOpts.ExportDestinationOptions = diskOpts crSettlement.Export(exportOpts) 'Exporting report to a PDF format crSettlement = Nothing Return Nothing Catch ex As Exception strProcedure = "CreateSettlementReport()" strMsg = ex.Message WriteToErrorFile(strMsg, strProcedure, strProgram, intRecordCount) Return ex End Try
"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"
I have know idea what this means. The variable strReportType is the Command Line parameter.
Please help!
Thanks,




Reply With Quote