Results 1 to 3 of 3

Thread: Crystal VB6 - Passing multiple values to a parameter from VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    9

    Crystal VB6 - Passing multiple values to a parameter from VB6

    Hi,

    I am trying to pass multiple values to a parameter from VB6 to Crystal.
    I have a parameter configured as to receive multiple discrete values, but can´t find the way to pass these values from VB6.
    Any help would be apreciated.

    Thanks,

    Thomas

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Crystal VB6 - Passing multiple values to a parameter from VB6

    Which version of Crystal?

    Call the ParameterFieldDefinition.AddCurrentValue method for each value you want to pass to the report.

    Code:
    Private oCrystalApp As CRAXDRT.Application
    
    Private Sub Command1_Click()
    Dim oReport As CRAXDRT.Report
    Dim oParms As CRAXDRT.ParameterFieldDefinition
    
    Set oReport = oCrystalApp.OpenReport("C:\report1.rpt")
    
    Set oParms = oReport.ParameterFields.GetItemByName("Customer Names")
    oParms.AddCurrentValue "GODOS"
    oParms.AddCurrentValue "BOTTM"
    oParms.AddCurrentValue "CACTU"
    oParms.AddCurrentValue "BSBEV"
    
    With frmReportViewer
        .rptViewer.ReportSource = oReport
        .rptViewer.ViewReport
        .Show
    End With
    
    End Sub
    
    Private Sub Form_Load()
        Set oCrystalApp = New CRAXDRT.Application
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        Set oCrystalApp = Nothing
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    9

    Re: Crystal VB6 - Passing multiple values to a parameter from VB6

    I am using Crystal version 8
    Will try your code tomorrow.

    Many thanks,

    Thomas

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