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

urgent :how to pass query for subreport

Status
Not open for further replies.

satheesh

Programmer
Dec 23, 2001
7
IN
dear programmers

i need to display the data from 10 tables and it' like main report and sub report. in that i need to pass 2 queries.
one for main report and another one is for sub report.


i know how to pass SQL statement for main report. but i don't know how to pass SQL statement for sub report.

i am passing the values and SQL statement from VIsual basic

please any one hlep me..
 
You link the sub-report by using common parameter values in each report. Go to online help in crystal see "subreports" and under this will be linking instructions.

 
Hopefully, you are using the RDC integration method. If so, you need to open up the sub-report and set the properties that you need to pass the SQL.

Something like this:

Dim Report As CRAXDRT.Report
Dim SubReport As CRAXDRT.Report
Dim App As CRAXDRT.Application
Dim Sections As CRAXDRT.Sections
Dim Section As CRAXDRT.Section
Dim RepObjs As CRAXDRT.ReportObjects
Dim SubReportObj As CRAXDRT.SubreportObject
Dim n As Integer
Dim i As Integer

Set App = New CRAXDRT.Application
Set Report = App.OpenReport("your_report.rpt")
Report.Database.LogOnServer .....
Set Sections = Report.Sections
For n = 1 To Sections.Count
Set Section = Sections.Item(n)
Set RepObjs = Section.ReportObjects
For i = 1 To RepObjs.Count
If RepObjs.Item(i).Kind = crSubreportObject Then
Set SubReportObj = RepObjs.Item(i)
Set SubReport = SubReportObj.OpenSubreport
SubReport.SQLQueryString = "your SQL"
End If
Next i
Next n
CRViewer1.ReportSource = Report
CRViewer1.ViewReport

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top