Results 1 to 6 of 6

Thread: Help..on passing params to Crystal reports from VB5

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    211

    Help..on passing params to Crystal reports from VB5

    I am using VB5.0 and crystal reports 8.5 .
    New to crystal reports.

    could someone clarify some basic question please.
    1. should I use "Crystal reports" control or "Crystal report viewer"
    2. I have a report and I need to pass 3 parameter from my VB screen. How can I do that?

    thank you
    nath

  2. #2
    New Member
    Join Date
    Feb 2002
    Location
    Newcastle(Kzn)
    Posts
    4
    I think u should use crystal report viewer so that u can have select statement there. It will be easy to pass those parameters of your.
    Phiwaz

  3. #3
    Lively Member
    Join Date
    Oct 2002
    Location
    Los Angeles, CA
    Posts
    73
    it's been a while since I used Crystal Report from VB, but I used
    CR control:

    with CR1
    .Connect = "ODBC;DATABASE=mm;UID=abx;PWD=abx;DSN=hh"
    .ReportFileName = App.Path & "\" & "myreport.rpt"
    strSelect =" {mytable.myfield} ='abc' "

    .SelectionFormula = strSelect
    end with

  4. #4
    Lively Member
    Join Date
    Oct 2002
    Location
    Los Angeles, CA
    Posts
    73
    Addition:

    you have to set CR1.Action = 1 in order to view report

  5. #5
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Georgia
    Posts
    337
    If you use the crviewer and need to pass more than one paramater in code here is what I put in the viewer

    Dim crpParamDef As CRAXDRT.ParameterFieldDefinition

    For Each crpParamDef In Report.ParameterFields
    Select Case crpParamDef.Name
    Case "{?Location}"
    crpParamDef.AddCurrentValue (CLng(frmStartInvAssignVolByCo.txtLocation.Text))
    Case "{?MasterCompany}"
    crpParamDef.AddCurrentValue (CLng(frmStartInvAssignVolByCo.txtCoID.Text))
    Case "{?StartDate}"
    crpParamDef.AddCurrentValue CDate(frmStartInvAssignVolByCo.txtStartDate.Text)
    Case "{?EndDate}"
    crpParamDef.AddCurrentValue CDate(frmStartInvAssignVolByCo.txtEndDate.Text)


    End Select
    Next
    --------------
    The paramaters are input by the user on a form that preceeds the viewer

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    211

    thank you guys

    thanks a lot guys

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