Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Main report is not passing parameter to subreport Post Reply Post New Topic
Author Message
maas
Newbie
Newbie


Joined: 26 May 2009
Location: Bahrain
Online Status: Offline
Posts: 15
Quote maas Replybullet Topic: Main report is not passing parameter to subreport
     Posted: 30 Apr 2014 at 3:06am
Can you please help me in passing a parameter from the main report to the subreport. I got an error saying that Cannot find parameter field Report_Number in subreport ABCD.rpt.

I have created a formula in the main report called {@report_number} which it has a value from the database {engine.rptno} which its type is number.

In the subreport, I created a parameter called {?Report_Number}, its type is number and the value of it is static. When I ran the report in the builder, the report will prompt for the {?Report_Number} and I will be able to enter the value and the report will show the data.

However, When I link the formula {@report_number} with the parameter {?Report_Number} using the "Change Subreport Link" and I unchecked the Select data based on the subreport field, I will get the error: Cannot find parameter field Report_Number in subreport ABCD.rpt. Even I tried to change the subreport link with the parameter {Pm-ReportNumber} and to select the data from the subreport which is {engine.rptno}, the error will be generated again for the parameter {Pm-ReportNumber}.

Also, I tried to delete the subreport and to remove the links, but all the attempts are not successful.

So can you please help me in solving the issue.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 30 Apr 2014 at 7:43pm
Hi ..
 
 
Strange..
 
While linking sub report to main do you see Report_Number parameter under sub report ?
 
Is your sub report is read only ? What version of Crystal reports you are using ?
 
Can you past or type the error message here.
 
-Sastry
Thanks,
Sastry
IP IP Logged
maas
Newbie
Newbie


Joined: 26 May 2009
Location: Bahrain
Online Status: Offline
Posts: 15
Quote maas Replybullet Posted: 30 Apr 2014 at 9:49pm
Hi sastry

It is a strange issue and I am facing it for the last couple of days without any success. I tried many thing, but all me attempts got failed.

While linking the subreport, I can see the Report_Number parameter and while previewing the report in Crystal Reports, the report is working fine and the parameter is passed to the subreport. However, when I am running it from the application, it gives the error:

Cannot find parameter field Report_Number in subreport ABCD.rpt.

And below it this error:

In: XYZSystems.Client.Crystal.ReportHandler.PrintReport (Line 0)

at CrystalDecisions.ReportAppServer.Controllers.ParameterFieldControllerClass.SetCurrentValues(String ReportName, String

ParameterFieldName, Values Values)

at CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition.ApplyCurrentValues(ParameterValues currentValues)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetParameterValue(String name, Object val)

at XYZSystems.Client.Crystal.ReportUI.DisplayReport()

at XYZSystems.Client.Crystal.ReportHandler.PrintReport(String rptfilepath, eXCRTo outputTo, Boolean doFooters, String

sequenceNumber, String userName, Object oCtx, Object ActiveDataTables, String& reportTime, Int32 viewerWindow, Int32

reportNumber, Object propertyBag, Boolean resourceSecurity, String programName)

What do you mean by my sub report is read only? Can I change it to enable the editing?

I am using Crystal Report 2011 where in the old version Crystal Report XI is working fine
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 30 Apr 2014 at 10:29pm
Hi
 
Using Crystal Reports 2011 you can create read only reports, which will not allow any user to edit it.
 
File--Report Options--Read Only  check box.  Just check is it checked.
 
Also right click on the sub report and go in format subreport--sub report tab and see 'Re-import when opening' is checked.  If so, uncheck, save and try in your application.
 
or
 
Try to insert a report in a blank report and create a parameter in main report and pass it to sub report and check ur able to do this.
 
-Sastry
 
Thanks,
Sastry
IP IP Logged
maas
Newbie
Newbie


Joined: 26 May 2009
Location: Bahrain
Online Status: Offline
Posts: 15
Quote maas Replybullet Posted: 30 Apr 2014 at 11:28pm
Thanks Sastry ... I will try this and I will come back

This issue is in this subreport only. In the same report, I am having other subreports which I can pass the parameters to them and they are working fine in both the run time and the preview except this subreport once I ran it with linking the report number parameter, it will display that error
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum