VB with Crystal Report Send parameter at run time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nithya jayaraman
    New Member
    • Jul 2007
    • 7

    #1

    VB with Crystal Report Send parameter at run time

    Hi, pls clarify these questions.

    1. How can I send some values of globla variables from VB to
    crystal report.
    I want to show these values on report.

    my database in MS Access


    My query is as follows...

    invoice table
    customer table
    purchase table

    using this table when user enter the invoice number in textbox and click report button , the report include the particular invoice detail and take over related customer details also...



    I want to send this values dynamically from VB(in the event of showing the
    report).
    If I use parameter field , System is prompting for the value at run
    time.
    How can I set this automatically?
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    every thing is okay, but you never point your CR version?

    and you are using Inbuild CR or external (Through VB, Calling that CR Rpt File).

    Comment

    • nithya jayaraman
      New Member
      • Jul 2007
      • 7

      #3
      Hi, pls clarify these questions.

      i am using external CR (Call by CR1.printreport )ver 4


      1. How can I send some values of globla variables from VB to
      crystal report.
      I want to show these values on report.

      my database in MS Access


      My query is as follows...

      invoice table
      customer table
      purchase table

      using this table when user enter the invoice number in textbox and click report button , the report include the particular invoice detail and take over related customer details also...



      I want to send this values dynamically from VB(in the event of showing the
      report).
      If I use parameter field , System is prompting for the value at run
      time.
      How can I set this automatically?
      Hi, pls clarify these questions.

      1. How can I send some values of globla variables from VB to
      crystal report.
      I want to show these values on report.

      my database in MS Access


      My query is as follows...

      invoice table
      customer table
      purchase table

      using this table when user enter the invoice number in textbox and click report button , the report include the particular invoice detail and take over related customer details also...



      I want to send this values dynamically from VB(in the event of showing the
      report).
      If I use parameter field , System is prompting for the value at run
      time.
      How can I set this automatically?

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        1. Create a DSN Connection in your system.
        2. Make sure connection done properly.

        then copy below code.

        Note : This is only for External Report and Version 9.

        [CODE=vb]
        '============== ====== Globel declaration in any Public Module
        Public strReportPath As string ' Report Path with Report Name As String
        Public StrRecordSelect ion As String ' Sql Query To Pase from any forum

        '============== =============== =In Report forum
        Dim crystal As New CRAXDRT.Applica tion ' LOADS REPORT FROM FILE
        Dim Report As New CRAXDRT.Report ' Declaring REPORT FROM FILE


        Private Sub Form_Load()
        On Error Resume Next
        ' Setting
        Set crystal = New CRAXDRT.Applica tion 'MANAGES REPORTS

        Set Report = Nothing ' Closing previous report
        Set Report = crystal.OpenRep ort(strReportPa th) ' OPEN New REPORT With String Path
        '------------------------- Opening Database with the help of DSN Connection.
        Report.Database .LogOnServer "pdsodbc.dl l", <strDatabaseNam eForSqlServer>, <strDSNName>, <strLoginName >, <strPassWord>
        '-------------------------Checking Condition Sql Query is available
        If StrRecordSelect ion <> "" Then
        Report.RecordSe lectionFormula = StrRecordSelect ion ' Passing Recored selection query to report
        End If
        Report.DiscardS avedData ' CLEARS REPORT SO WE WORK FROM RECORDSET
        Cry.ReportSourc e = Report ' LINK VIEWER TO REPORT
        Cry.ViewReport ' Show Report

        Cry.Zoom 1

        Set crystal = Nothing

        StrRecordSelect ion = "" ' Clear Query in globel variable
        strreportpath = "" ' Clear Report Path in globel variable
        End Sub[/CODE]

        Comment

        Working...