Passing Parameters to a Crystal Report with a Subreport



I've created a report that summarizes a client's record, but then has a
subreport attached that gives historical information.

Okay, here's the issue. I can call this report and pass it the parameters
needed through my .NET program and it works great if only 1 client is
selected. However, if multiple clients are selected then the subreport will
list every historical record for every client selected on each client's
summary report.

On the report: under the subreport links - I have the checkbox "Select data
in subreport based on field" checked. In the subreport - the parameter field
is set to allow "Multiple values" and "Discrete values".

In the program - I'm loading an array with each parameter value that's
selected from the main report (each client's id) and then I'm setting the
report's parameter value to that array.

Here's a snippet of the code:
For Each lRow As DataRow In DataSet.Rows 'Main report's dataset
Dim lpdvValue As ParameterDiscreteValue = New ParameterDiscreteValue

lpdvValue.Value = lRow("ID").ToString

CurrentParameterValues.Add(lpdvValue)

ParameterArray.Add(lpdvValue)
Next

'*** then after loading the main report...

If SubReportFlag Then 'Denotes whether a subreport is attached to the
report.
Dim lpfdDefinitions As ParameterFieldDefinitions =
objectReport.DataDefinition.ParameterFields
Dim lpfdDefinition As ParameterFieldDefinition =
lpfdDefinitions(ParameterName)

lpfdDefinition.ApplyCurrentValues(CurrentParameterValues)


objectReport.OpenSubreport(SubReportName).SetDataSource(subreportdataset)
objectReport.SetParameterValue(ParameterName,
ParameterArray.ToArray(), SubReportName)
End If

As stated previously, it works fine if the user selects 1 client, but not
with multiple clients....what am I missing?
--
Cindy

.



Relevant Pages

  • Re: print current record on main form and subform
    ... Each client can be screened multiple times. ... So I have multiple screening ... I have a report set up with client ... Because you are using a subreport, ...
    (microsoft.public.access.formscoding)
  • RE: *REPOST* If then Else Statment in Report
    ... "Duane Hookom" wrote: ... when a main report doesn't return records. ... Earlier as we found I was confused about the name of the control ... which is the name of the subreport as seen in the database window. ...
    (microsoft.public.access.reports)
  • Re: Pulling back sub-report
    ... we are talking about a report with a subreport. ... Fields, and Link Master Fields. ... for just that client. ...
    (microsoft.public.access.reports)
  • RE: *REPOST* If then Else Statment in Report
    ... Earlier as we found I was confused about the name of the control ... with my report controls. ... "Duane Hookom" wrote: ... which is the name of the subreport as seen in the database window. ...
    (microsoft.public.access.reports)
  • RE: Should be simple but...
    ... When I look at the subreport preview, ... This does not affect my sample report because I have not input all staff, ... "Duane Hookom" wrote: ... "Aria" wrote: ...
    (microsoft.public.access.reports)