[RESOLVED] Record selection in subreport
Hello everybody,
I need to pass record selection formula from my application to subreport but it goes into the main report and the application blows up saying it cannot find the field. How can I specify that this foruma should go in subreport and not in the main report?
Thanks.
Re: Record selection in subreport
Using the Crystal Reports ActiveX Runtime Library (CRAXDRT - depending on your version) you can access and manipulate a Subreport just as you would the Main report. All you need to do is open the Subreport. Something like.
Code:
Option Explicit
Private objCrystalApp As CRAXDRT.Application
Private Sub Command1_Click()
Dim objMainReport As CRAXDRT.Report
Dim objSubReport As CRAXDRT.Report
Set objMainReport = objCrystalApp.OpenReport("C:\report1.rpt")
objMainReport.RecordSelectionFormula = "{Customers.CustomerID} = 'WOLZA'"
Set objSubReport = objMainReport.OpenSubreport("Orders")
objSubReport.RecordSelectionFormula = "{Orders.CustomerID} = 'WOLZA'"
objMainReport.PrintOut
End Sub
Private Sub Form_Load()
Set objCrystalApp = New CRAXDRT.Application
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set objCrystalApp = Nothing
End Sub
Re: [RESOLVED] Record selection in subreport
how can we connect database to this report in runtime..to view current details ?