asm
Dec 21st, 2005, 01:29 AM
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...
Private Sub CrView9()
Dim crApp As CRAXDRT.Application
Dim crReport As CRAXDRT.report
Dim crRs As ADODB.Recordset
Dim crSQL As String
Call Form_Resize1
CRViewer.DisplayBorder = False
CRViewer.EnableGroupTree = False
CRViewer.DisplayTabs = False
CRViewer.EnableRefreshButton = False
CRViewer.EnableExportButton = True
crSQL = "SELECT * FROM category"
Set crRs = New ADODB.Recordset
Set crRs = ConnectAcct.Execute(crSQL)
Set crApp = New CRAXDRT.Application
Set crReport = crApp.OpenReport(App.path & "\categ.rpt", 1)
crReport.Database.SetDataSource crRs, 3, 1
CRViewer.ReportSource = crReport
CRViewer.ViewReport
'Pause Report While Loading
Do While CRViewer.IsBusy
DoEvents
Loop
CRViewer.Zoom 94
Set crApp = Nothing
Set crReport = Nothing
crRs.Close
Set crRs = Nothing
End Sub
Private Sub CmdPreview_Click()
Call CrView9 ' CRYSTAL 9 CALLING PROCEDURE
' CRYSTAL 6 REPORT CALLING PROCEDURE
' Dim strRepName As String
' Dim SqlString As String
' strRepName = "categ.rpt"
' SqlString = "select * from category"
' Me.CrystalReport1.ReportFileName = strRepName
' Me.CrystalReport1.SQLQuery = SqlString
' Me.CrystalReport1.Destination = crptToWindow
' Me.CrystalReport1.Connect = "dsn= " & DsnName & ""
' Me.CrystalReport1.Formulas(0) = "compname = '" & CompanyName & "'"
' Me.CrystalReport1.Action = 1
End Sub
Private Sub Form_Resize1()
CRViewer.Top = 0
CRViewer.Left = 0
CRViewer.Height = ScaleHeight
CRViewer.Width = ScaleWidth
End Sub
Private Sub Form_Load()
Call ConnectData
Call CompDetail
End Sub
thanks
asm
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...
Private Sub CrView9()
Dim crApp As CRAXDRT.Application
Dim crReport As CRAXDRT.report
Dim crRs As ADODB.Recordset
Dim crSQL As String
Call Form_Resize1
CRViewer.DisplayBorder = False
CRViewer.EnableGroupTree = False
CRViewer.DisplayTabs = False
CRViewer.EnableRefreshButton = False
CRViewer.EnableExportButton = True
crSQL = "SELECT * FROM category"
Set crRs = New ADODB.Recordset
Set crRs = ConnectAcct.Execute(crSQL)
Set crApp = New CRAXDRT.Application
Set crReport = crApp.OpenReport(App.path & "\categ.rpt", 1)
crReport.Database.SetDataSource crRs, 3, 1
CRViewer.ReportSource = crReport
CRViewer.ViewReport
'Pause Report While Loading
Do While CRViewer.IsBusy
DoEvents
Loop
CRViewer.Zoom 94
Set crApp = Nothing
Set crReport = Nothing
crRs.Close
Set crRs = Nothing
End Sub
Private Sub CmdPreview_Click()
Call CrView9 ' CRYSTAL 9 CALLING PROCEDURE
' CRYSTAL 6 REPORT CALLING PROCEDURE
' Dim strRepName As String
' Dim SqlString As String
' strRepName = "categ.rpt"
' SqlString = "select * from category"
' Me.CrystalReport1.ReportFileName = strRepName
' Me.CrystalReport1.SQLQuery = SqlString
' Me.CrystalReport1.Destination = crptToWindow
' Me.CrystalReport1.Connect = "dsn= " & DsnName & ""
' Me.CrystalReport1.Formulas(0) = "compname = '" & CompanyName & "'"
' Me.CrystalReport1.Action = 1
End Sub
Private Sub Form_Resize1()
CRViewer.Top = 0
CRViewer.Left = 0
CRViewer.Height = ScaleHeight
CRViewer.Width = ScaleWidth
End Sub
Private Sub Form_Load()
Call ConnectData
Call CompDetail
End Sub
thanks
asm