Pass parameters from VB to crystal report


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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SeejaanilkumarAuthor Commented:
Thanks for ur response. I am not getting the above site. Anyway I found a solution by myself.

What was your solution?

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
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
        End If
    Next LUO_Object
Next LCRX_Section
WCRX_Report.ParameterFields.Item(1).AddCurrentValue DTP_Date.Value
CRV_Report.ReportSource = WCRX_Report
Set WCRX_Report = Nothing

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.