• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

Pass parameters from VB to crystal report

Hi,

How can I connect a report created in Crystal report 8.0 with VB using RDC and pass parameters? I want to change my connection parameters at runtime.

Seeja
0
Seejaanilkumar
Asked:
Seejaanilkumar
  • 2
  • 2
1 Solution
 
SeejaanilkumarAuthor Commented:
Thanks for ur response. I am not getting the above site. Anyway I found a solution by myself.

Seeja
0
 
mlmccCommented:
What was your solution?

mlmcc
0
 
SeejaanilkumarAuthor Commented:
The following is the solution.

Dim LNI_I As Integer
Dim LCRX_SubReport As CRAXDRT.Report
Dim LUO_Object As Object
Dim LCRX_Section As CRAXDRT.Section
Dim LCRX_SubReportObject As CRAXDRT.SubreportObject
Set WCRX_Application = CreateObject("CrystalRunTime.Application")
Set WCRX_Report = WCRX_Application.OpenReport(App.Path & LNS_ReportName)
For LNI_I = 1 To WCRX_Report.Database.Tables.Count
    WCRX_Report.Database.Tables.Item(LNI_I).SetLogOnInfo GNS_Dsn, , GNS_DbUserId, GNS_DbPswd
Next
For Each LCRX_Section In WCRX_Report.Sections
    For Each LUO_Object In LCRX_Section.ReportObjects
        If LUO_Object.Kind = crSubreportObject Then
            Set LCRX_SubReportObject = LUO_Object
            Set LCRX_SubReport = LCRX_SubReportObject.OpenSubreport
            For LNI_I = 1 To LCRX_SubReport.Database.Tables.Count
                LCRX_SubReport.Database.Tables.Item(LNI_I).SetLogOnInfo GNS_Dsn, , GNS_DbUserId, GNS_DbPswd
            Next
        End If
    Next LUO_Object
Next LCRX_Section
WCRX_Report.ParameterFields.Item(1).AddCurrentValue DTP_Date.Value
CRV_Report.ReportSource = WCRX_Report
CRV_Report.ViewReport
Set WCRX_Report = Nothing

Seeja
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now