I have a report which contains parameters. If this is just a single report on its own it works fine and I can pass the parameters in no problem. I am now trying to include this report as a subreport in another report and I can't pass the parameters in at all.
Here is the code
'Access the specified parameter from the parameters collection Dim parameter As ParameterFieldDefinition = crsSubreports.ReportDocument.DataDefinition.ParameterFields("@pool", "LeagueTable") Dim currentValues As CrystalDecisions.Shared.ParameterValues = parameter.CurrentValues currentValues.Clear() 'Create a value object for Crystal reports and assign the specified value Dim newValue As New CrystalDecisions.Shared.ParameterDiscreteValue() newValue.Value = "A" 'Now add the new value to the values collection and apply the collection to the report. currentValues.Add(newValue) parameter.ApplyCurrentValues(currentValues)
I get the error "Index was outside the bounds of the array. " on this line Dim parameter As ParameterFieldDefinition = crsSubreports.ReportDocument.DataDefinition.ParameterFields("@pool", "LeagueTable")
I presume I am accessing the parameter wrong. I have tried all permutations such as @pool and pool for the parameter name and LeagueTable and LeagueYable.rpt for the subreport name. For the subreport, the object name is "LeagueTable" and the subreport name is "LeagueTable.rpt"