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!

How can I send a parameter to a stored Proc in a subreport ????

Status
Not open for further replies.

lorein

Programmer
Oct 21, 2003
25
0
0
MX
How can I send a parameter to a stored Proc in a subreport ????

I'm using Crystal reports 8.5, oracle 9i and VB6.
I'm using the OCX from crystal.
My reports uses oracle stored procedures
The problem is when I call a report from my VB application and this report has subreports I don't know how send the stored procedure parameters to a subreport. But If my report doesn't has subreports I dont have any problem.
This is the code that I'm using

With CrystalRep
.Reset
.DiscardSavedData = True
.WindowState = crptMaximized
.WindowShowSearchBtn = True
.WindowShowExportBtn = True
.ReportFileName = sRepName
.StoredProcParam(0) = "null"
.StoredProcParam(1) = "Bs"
.Connect = "UID;PWD"

iResult = .PrintReport

If iResult <> 0 Then
MsgBox .LastErrorString, 16, CStr(.LastErrorNumber)
Screen.MousePointer = vbArrow
End If

End With

Please if somebody knows how to handle this problem I really appreciate your help
Thanks!




Lorein....
 
Thanks for your response synapsevampire

But my problem is with a storedprocedure parameter.

I,m trying to resolve this in another way, I removed the Stored procedure from my subreport and I create a SQl query. Then I create a shared variable in my main report and I try to pass this value to the subreport.
The shared variable take the value from a parameter

shared Initdate as string
Initdate ={?FECHA}
formula = Initdate

I declare the shared variable in my subreport
the formula name is InitialDate

shared Initdate as string
formula = Initdate

I don't know how pass the value of this variable to the SQL query in my subreport, I try to add the next where condition in the Show SQL query window

where Date = @InitialDate

But it fails

Do you know how can I do this??

Thanks

I really appreciate your help!!!





Lorein....
 
You can abandon the shared variable, and just link your subreport with the main report's parameter ({?FECHA}).

From the main report, right click on the subreport and click 'Change Subreport Links'. From the Available fields list, select your parameter into the Field(s) to Link To list. Use the default parameter it creates (?Pm-FECHA), check 'Select data in subreport based on field', then pick you {Table.Date} field. You don't need to mess with the record selection of the subreport. Crystal will put it in there automatically.

-dave
 
Thanks for your response Dave

Lorein....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top