Results 1 to 2 of 2

Thread: passing parameter in crystal report

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    29

    Arrow passing parameter in crystal report

    how do i pass the parameter set in crystal report to the form.. for example.. i have a combobox and a report..so how do i choose the item in the combobox and redirect it to the report.. heres how i did it but doesn't works..


    Dim pvCollection As New CrystalDecisions.Shared.ParameterValues()
    Dim pdvdept As New CrystalDecisions.Shared.ParameterDiscreteValue()
    Dim rptCrystalReport3 As New ReportDocument()

    ' In this event the Ten Most Expensive Products Report is loaded
    ' and displayed in the crystal reports viewer.

    ' Objects used to set the proper database connection information
    Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
    Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

    ' Create a report document instance to hold the report


    Try

    ' Load the report
    rptCrystalReport3.Load("..\CrystalReport3.rpt")

    ' Set the connection information for all the tables used in the report
    ' Leave UserID and Password blank for trusted connection




    ' Set the discreet value to the customers name.
    pdvdept.Value = ComboBox1.Text <<<<----------(I STILL CAN CHOOSE FROM THE COMBOBOX)



    ' Add it to the parameter collection.
    pvCollection.Add(pdvdept)


    ' Apply the current parameter values.
    rptCrystalReport3.DataDefinition.ParameterFields("@dept").ApplyCurrentValues(pvCollection)


    ' Hide group tree for this report
    CrystalReportViewer1.DisplayGroupTree = False


    ' Set the report source for the crystal reports viewer to the
    ' report instance.
    CrystalReportViewer1.ReportSource = rptCrystalReport3

    ' Zoom viewer to fit to the whole page so the user can see the report
    CrystalReportViewer1.Zoom(2)



    Catch Exp As LoadSaveReportException
    MsgBox("Incorrect path for loading report.", _
    MsgBoxStyle.Critical, "Load Report Error")

    Catch Exp As Exception
    MsgBox(Exp.Message, MsgBoxStyle.Critical, "General Error")

    End Try


    Can anyone help me..its kinda urgent!

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    29

    Re: passing parameter in crystal report

    seems like no one reply..hmm.. i almost gave up on this prob.. but i think i'll wait..for few more days..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width