Link to home
Start Free TrialLog in
Avatar of John Porter
John PorterFlag for United States of America

asked on

Passing params to Subreport from Main Report - Crystal Reports VS 2005

Hello,

I am having trouble keeping parameter links between the main report and its sub reports.

Background:
I am developing with C# VS 2005, VS 2005 Crystal Reports and SQL Server 2000.
I have several reports (with embedded sub reports) that pass values to different SPROCS in SQL server.

Example:
One Report has three sub reports. The Main report and all three sub reports are linked to different stored procedures but pass the same parameters to their respective SPROC.  My C# App passes params to the main report. The main report then passes appropriate params on to each sub report. The main report and sub reports pass appropriate params on to their stored procedures.

This all works great until I Reset the DataSource location to a copy of the same database (Same exact Stored Procedures). After doing this, the link is broken for Parameters between the main report and sub reports. I am unable to re-establish the link. I do this by  going to Change Subreport links, choose the main report params and designate the sub report parms, choosing the subreports @ params not PM params.

Does anyone see what might be happening here??

Thanks,
John
Avatar of Mike McCracken
Mike McCracken

Are you reimporting the subreport when you run?
Check RIGHT click the subrpeort
CLick FORMAT

mlmcc
Avatar of John Porter

ASKER

No - I actually created the subreports on the fly (On Main Form only) so there is not a subreport to import.
John
It is probably because the report doesn't really exist.

Do you save the main report at any time?

mlmcc
The links work fine until I change datasource locations (Connect to the same stored procedure in a different dabase).

John
mlmcc - that was it...

When I first created this report, I was just figuring things out as I went so I didn't create the subreport from an existing report. Rather I created the subreport on the main report. Apparantly this works fine until you point to a different database.

I recreated a report - then imported it into the main report as a subreport and the links work. The question is will they still work when I change datasource locations again?

Thanks,
John
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks mlmcc!

That was exactly the problem. I recreated the subreports as "stand alone" then imported them in as subreports and all params work great.

John