Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub Report Run without Parameters.

Status
Not open for further replies.

Crystalboy1

Programmer
Sep 4, 2007
89
GB
hi All,

While developing reports, I noticed a very strange problem. Let me explain what I am doing and how.

I got a MainReport, which got 2 SubReport.

The MianReport, I got 1 parameter Rundate, I execute a stored Procedure in the COMMAD (database object) to generate a Report ID. Example Code is given below. (dis is for audit purpose)

DECLARE @REPORTID_EXT AS INT

EXEC [dbo].[usr_BI_Orbit_Report_Audit_Insert]
'ORU1 Arrears KPI Report',
{?Rundate},
'',
'',
'',
'' ,
'' ,
'' ,
'',
@REPORTID_EXT OUTPUT

select @REPORTID_EXT as 'ReportID'





Now SubReport 1.
I pass two parameter from the mainreport to the subreport 1.

Rundate
ReportID (generated above).

Its suppose to run a procedure which will generate data,save in a tableA with the ReportID and show in grouped from in the sub report 1.

SubReport 2. got 1 parameter link
ReportID

It directly read the data (generated in subreport 1 procedure) from the tableA. Do some manipulation with the data and present.

That’s how the report should work.

Problem.
The Problem is, the Procedure in the subreport 1 executes as soon as I run the mainreport. Without the (reportID generated in the mainreport). Which results in an error that some paramters are missing. If I click on cancal or OK. by that time the reportID is generated and the report showes the correct result.

When I looked into the data, the StoredProceudre behind the SUbReport1 seems to be running 2 times, 1 without the ReportID, (which is int so for a null entry its put 0 (zero) and runs … and second time for the right values).

Though the report is returning me the right results but I don’t want it to run twice and use extra resources of the database. Any suggestions welcomed…
 
PLZZZZ dont REPLY to this Thread. it was posted by mistake. i already have posted this thread in the Crystal Reports 2 data Access section.

Plz reply there not here. thanks and sorry for in convinence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top