Results 1 to 2 of 2

Thread: [RESOLVED] crystal 6 to crystal 9

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Resolved [RESOLVED] crystal 6 to crystal 9

    Hi

    In crystal report6 we can call formula in report from vb6 like this
    ' using crystal report control (component)

    Me.CrystalReport1.Formulas(0) = "compname = '" & CompanyName & "'"

    But now I want to convert cr6 report to cr9, Now problem is
    how can i show the formula in report.
    Please help me for this problem...

    VB Code:
    1. Private Sub CrView9()
    2.     Dim crApp As CRAXDRT.Application
    3.     Dim crReport As CRAXDRT.report
    4.     Dim crRs As ADODB.Recordset
    5.     Dim crSQL As String
    6.     Call Form_Resize1
    7.     CRViewer.DisplayBorder = False
    8.     CRViewer.EnableGroupTree = False
    9.     CRViewer.DisplayTabs = False
    10.     CRViewer.EnableRefreshButton = False
    11.     CRViewer.EnableExportButton = True
    12.     crSQL = "SELECT * FROM category"
    13.     Set crRs = New ADODB.Recordset
    14.     Set crRs = ConnectAcct.Execute(crSQL)
    15.     Set crApp = New CRAXDRT.Application
    16.     Set crReport = crApp.OpenReport(App.path & "\categ.rpt", 1)
    17.     crReport.Database.SetDataSource crRs, 3, 1
    18.     CRViewer.ReportSource = crReport
    19.     CRViewer.ViewReport
    20.     'Pause Report While Loading
    21.     Do While CRViewer.IsBusy
    22.         DoEvents
    23.     Loop
    24.     CRViewer.Zoom 94
    25.     Set crApp = Nothing
    26.     Set crReport = Nothing
    27.     crRs.Close
    28.     Set crRs = Nothing
    29. End Sub
    30.  
    31.  
    32.  
    33. Private Sub CmdPreview_Click()
    34.  
    35.     Call CrView9        ' CRYSTAL 9 CALLING PROCEDURE
    36.  
    37. '    CRYSTAL 6 REPORT CALLING PROCEDURE    
    38. '    Dim strRepName As String
    39. '    Dim SqlString As String
    40. '    strRepName = "categ.rpt"
    41. '    SqlString = "select * from category"
    42. '    Me.CrystalReport1.ReportFileName = strRepName
    43. '    Me.CrystalReport1.SQLQuery = SqlString
    44. '    Me.CrystalReport1.Destination = crptToWindow
    45. '    Me.CrystalReport1.Connect = "dsn= " & DsnName & ""
    46. '    Me.CrystalReport1.Formulas(0) = "compname = '" & CompanyName & "'"
    47. '    Me.CrystalReport1.Action = 1
    48. End Sub
    49.  
    50. Private Sub Form_Resize1()
    51.     CRViewer.Top = 0
    52.     CRViewer.Left = 0
    53.     CRViewer.Height = ScaleHeight
    54.     CRViewer.Width = ScaleWidth
    55. End Sub
    56.  
    57. Private Sub Form_Load()
    58.     Call ConnectData
    59.     Call CompDetail
    60. End Sub

    thanks

    asm

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: crystal 6 to crystal 9

    Try this
    VB Code:
    1. Set crReport = crApp.OpenReport(App.Path & "\categ.rpt", 1)
    2.     crReport.FormulaFields.GetItemByName("compname").Text = "'" & CompanyName & "'"
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

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