Results 1 to 3 of 3

Thread: help in Passing Date parameters into crystal report

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    2

    help in Passing Date parameters into crystal report

    hi..
    can anybody help me in passing date parameters into crystal report?

    i wanna do something like the user types in the date and clicks on the OK button to view the crystal report according to the date typed by the user..


    below is my codings..
    but there's this error upon clicking the OK button..
    "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX)"
    at the bolded lines below..


    Code:
    Private Sub btn_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ok.Click
    
            Dim cryRpt As New ReportDocument
            cryRpt.Load("C:\CrystalReport3.rpt")
    
            Dim crParameterFieldDefinitions As ParameterFieldDefinitions
            Dim crParameterFieldDefinition As ParameterFieldDefinition
            Dim crParameterValues As New ParameterValues
            Dim crParameterDiscreteValue As New ParameterDiscreteValue
    
            crParameterDiscreteValue.Value = TextBox1.Text
            crParameterFieldDefinitions = _
       cryRpt.DataDefinition.ParameterFields
            crParameterFieldDefinition = _
       crParameterFieldDefinitions.Item("DealDate")
            crParameterValues = crParameterFieldDefinition.CurrentValues
    
            crParameterValues.Clear()
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    
            TestReport.CrystalReportViewer1.ReportSource = cryRpt
            TestReport.CrystalReportViewer1.Refresh()
    
        End Sub


    can anyone help me in solving the problem?
    =/

    i appreciate any help
    Thanks alot!!
    Last edited by xiaoting; Nov 4th, 2008 at 12:54 AM.

  2. #2
    New Member
    Join Date
    Dec 2007
    Posts
    9

    Re: help in Passing Date parameters into crystal report

    Hi

    Not sure if you can use "ParamName" type index. Try using 1 for first parameter, 2 for second parameters etc.

    HTH

    Daz

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    2

    Re: help in Passing Date parameters into crystal report

    hi thanks for your reply!
    (:
    i managed to solve the problem already it's because of the ("DealDate") which doesn't exist in my CR.. =x
    thanks!

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