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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Parameters from a main to Sub report

Status
Not open for further replies.

Dross

Programmer
Aug 16, 2001
212
0
0
US
I have a parameter that is a number. I want to pass that number into the main report and have it passed to the subreport from an asp. How do I set up Crystal so the sub reports use the same number that I enter into the main report?
 
Right click on the subreport oject (in the main report design view) and select Change Subreport Links. Select your Main Report parameter from the Available Fields list into the Fields to link to box. Then selcct the subreport parameter field and the subreport data field to match in the lower section of the dialog.
 
The catch here is that Crystal will create a new parameter for you to link in the subreport which you have to avoid and reach for the hard-to-find scroll in the list box to see the parameters which are already there in the subreport so that you can link to them.. I have already wasted lots of time in figuring this out so hope you don't repeat that
 
I am using 2 stored procedures. 1 for the main report and then the subreports work off the second one. Should I be able to link those? I still can't get it to work.
 
Yes, you should be able to use a separate stored procedure for your subreport. The subreport makes its own data access, independently of the main report. Things to check:
1.If your subreport SP has parameter(s), those parameters are passed automatically to the subreport. Be sure you are linking to those parameters and NOT to the parameters CR creates (?Pm-xxx) when you insert or import a subreport. See ksarda's earlier post.
2. Look at your subreport's record selection formula, if there is one and if it uses parameter values, to be sure the formula uses the correct parameters.
3. As a test, save your subreport as a separate .rpt file and see if it will run as a stand-alone report.
 
Hi Friends,

I'm using Crystal Report in VB to print report by extracting records from SQL Server. I create a stored procedure with two parameters of fromdate and todate. In my VB app., the user can specify the from date and to date values. Below is the code in VB

frmMdiMain.crptOFAS.Destination = 0
frmMdiMain.crptOFAS.WindowState = crptMaximized
frmMdiMain.crptOFAS.Formulas(0) = "fldfromdt='" & mskFromDt.Text & "'"
frmMdiMain.crptOFAS.Formulas(1) = "fldtodt='" & mskToDt.Text & "'"
frmMdiMain.crptOFAS.ReportFileName = strRepPath + "rptenqperiod.rpt"
strCriteria = "{repEnqPeriod.enq_dt} in Date(" & Format$(mskFromDt.Text, "dd Mmm,YYYY") & ") to Date (" & Format$(mskToDt.Text, "dd Mmm,YYYY") & ")"
frmMdiMain.crptOFAS.SelectionFormula = strCriteria
frmMdiMain.crptOFAS.Action = 1

When I'm executing this it display an error message called

Runtime error 20515
Error in Formula

I create two fields in my crystal report called fldtodt and fldfromdt. Is this is the proper way or am I missing something.........

Pls guide me how can we call a parametrised procedure from crystal report

Thanks in advance

Cheers
Manoj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top