I am passing multiple parameters (ID's) using an array to a Crystal Report. I am receiving the following message when running my code:
"Crystal Report Viewer"
"This array must be subscripted. For example: Array [i]."
Here is my code:
I have the parameter in the report set to 'Allow Multiple Values'.Code:Private Sub SettleSched_Par() Dim strInput As String Dim strValues() As String Dim i As Integer '--------Encapslulated code opens cr report-------- Dim Report As New rptFundBuySched Dim crPDefs As CRAXDRT.ParameterFieldDefinitions Dim crPDef As CRAXDRT.ParameterFieldDefinition Set crPDefs = Report.ParameterFields For Each crPDef In crPDefs With crPDef Select Case .ParameterFieldName Case "TradeIDParm" 'Get the ID's. strInput = InputBox("Enter trade ID's seperated by commas.", "Enter Trade ID's") 'Split them into an array. strValues = Split(strInput, ",") 'Add parameter(s). For i = 0 To UBound(strValues) .AddCurrentValue CDbl(strValues(i)) Next i End Select End With Next Report.EnableParameterPrompting = False frmRptView.CRViewer1.ReportSource = Report frmRptView.Show frmRptView.CRViewer1.ViewReport '------------------------------------------------- End Sub
Help appreciated. Thx![]()




Reply With Quote