Passing SQL Server parameters to subreports in Crystal Reports 6 from VB 
Author Message
 Passing SQL Server parameters to subreports in Crystal Reports 6 from VB

If you're having problems passing stored procedure parameters to a
subreport that is embedded in a main report in Crystal Reports, you
may want to try the following:

Note: You will need to add "Crystal Reports Engine Object Library
6.0", to your project references.

Global g_CrystalApplication As CRPEAuto.Application

Private Sub SomeSub()
   Dim MainReport As CRPEAuto.Report
   Dim SubReport As CRPEAuto.Report

    Set MainReport = g_CrystalApplication.OpenReport("Main.rpt")
    With MainReport.Database
        .Parameters(1).Value = CStr(Me.txtStartDate.Text)
        .Parameters(2).Value = CStr(Me.txtEndDate.Text)
        End With

    Set SubReport = MainReport.OpenSubreport("Sub.rpt")
    With SubReport.Database
        .Parameters(1).Value = CStr(Me.txtStartDate.Text)
        .Parameters(2).Value = CStr(Me.txtEndDate.Text)
        End With

    PrintReport "Main", True

    Set SubReport = Nothing
    Set MainReport = Nothing
End Sub

Mon, 12 Jul 2004 02:02:01 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Crystal Web Reports Server 7 string parameters arent being passed to SQL Server StoredProc


3. Passing Parameters from C# to Crystal Report / Crystal Report Viewer

4. Pass parameter to a MS SQL stored procedure from Crystal Report 6.0

5. Q: Pass a SQL query from VB to crystal report sub-report

6. Crystal Report based on SQL Server Stored Procedure with Parameters

7. vb5 Crystal Reports 6 and Subreports Can we conditionally call subreports from primary reports

8. Passing Parameter from Main Report to 3 Subreports

9. How do you pass parameters from VB 5 to crystal reports

10. How to pass parameter from VB.Net to Crystal Report

11. Passing a variable from VB.NET to a Crystal report parameter or formula with no prompt

12. Pass Parameter to Crystal Reports from VB


Powered by phpBB® Forum Software