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

how to pass query to crystal report from visual basic

Status
Not open for further replies.

satheesh

Programmer
Dec 23, 2001
7
IN
hello everybody

how to pass 2 sql query to crystal report for main report and subreport with date range

i have to pass query for main report and as well as sub report. i designed the report with main& sub report. i wan to pass 2 query to main and subreport during the run time.
please let me know this to finish the project.

thanks

 
Hi,
Try the following,

Dim crpSubreport As CRAXDRT.Report
Dim crpDatabase As CRAXDRT.Database
Dim crpDatabaseTables As CRAXDRT.DatabaseTables
Dim crpDatabaseTable As CRAXDRT.DatabaseTable
Dim crpSections As CRAXDRT.Sections
Dim crpSection As CRAXDRT.Section
Dim crpReportObjects As CRAXDRT.ReportObjects
Dim crpSubreportObject As CRAXDRT.SubreportObject
Dim cnt As Integer

Set crpSections = rpt.Sections
For Each crpSection In crpSections
Set crpReportObjects = crpSection.ReportObjects
For cnt = 1 To crpReportObjects.Count
If crpReportObjects.Item(cnt).Kind = crSubreportObject Then
Set crpSubreportObject = crpReportObjects.Item(cnt)


Set crpSubreport = rpt.OpenSubreport("subreport Name refered in main report")

Set crpDatabase = crpSubreport.Database
Set crpDatabaseTables = crpDatabase.Tables
Set crpDatabaseTable = crpDatabaseTables.Item(1)


crpDatabaseTable.SetPrivateData 3, recordset to be passed

Exit For
End If
Next cnt
Next crpSection
 
Dear Friend

thanks for your answer. but i am new for this job. so please tell me exactly where i should place the query in this code.

thanks for considering my request
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top