gchwee
04-14-2004, 12:15 PM
Hi, How to pass the data range from vb6.0 to crystal report9.0?
Someone told me that i should use Selection formula, Someone told me that i should use the SQLQueryString to pass it. I did try both of them, But i fail...
what i try as below:
Public Report1 As New CRAXDRT.Report
Private Sub Form_Load()
Dim crxApp As New CRAXDRT.Application
dim a as String
Screen.MousePointer = vbHourglass
Set Report1 = crxApp.OpenReport("C:\Repor1.rpt")
crxreport.SQLQueryString = "SELECT name, address FROM Table1 WHERE name = "&a""
CRViewer91.ReportSource = crxreport
CRViewer91.ViewReport
CRViewer91.Zoom 94
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub[/COLOR]
'ERROR
====================
Ok, nvm, So... i try SelectionFormula from other forum discuss.
Private Sub Form_Load()
Dim crxApp As New CRAXDRT.Application
Dim report1 As New CRAXDRT.Report
Screen.MousePointer = vbHourglass
Dim a As String
Set report1 = crxApp.OpenReport("c:\Report1.rpt")
a = Form2.Text1.Text
report1.RecordSelectionFormula = "{Table1.name} = ' " & a & " ' "
CRViewer91.ReportSource = report1
report1.DiscardSavedData
CRViewer91.ViewReport
CRViewer91.Zoom 94
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub
ERROR: 'null Report show. How come?
Why the command below is not recognise by my vb6.0? izit bcos i forget to declare of it?
CRP1.DataFiles(0) = DataSource
CRP1.ReportFileName = App.Path & "\Reports\" & FileName
CRP1.WindowTitle = title
CRP1.Destination = Destination
CRP1.WindowState = crptMaximized
CRP1.Action = crptToWindow
I already create a beautiful design and full record crystal report, i just wish to use vb to activate/pass parameter to the cystalreport's SELECTIONEXPERT to generate seperate account of report, can i?
Thanks~
Someone told me that i should use Selection formula, Someone told me that i should use the SQLQueryString to pass it. I did try both of them, But i fail...
what i try as below:
Public Report1 As New CRAXDRT.Report
Private Sub Form_Load()
Dim crxApp As New CRAXDRT.Application
dim a as String
Screen.MousePointer = vbHourglass
Set Report1 = crxApp.OpenReport("C:\Repor1.rpt")
crxreport.SQLQueryString = "SELECT name, address FROM Table1 WHERE name = "&a""
CRViewer91.ReportSource = crxreport
CRViewer91.ViewReport
CRViewer91.Zoom 94
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub[/COLOR]
'ERROR
====================
Ok, nvm, So... i try SelectionFormula from other forum discuss.
Private Sub Form_Load()
Dim crxApp As New CRAXDRT.Application
Dim report1 As New CRAXDRT.Report
Screen.MousePointer = vbHourglass
Dim a As String
Set report1 = crxApp.OpenReport("c:\Report1.rpt")
a = Form2.Text1.Text
report1.RecordSelectionFormula = "{Table1.name} = ' " & a & " ' "
CRViewer91.ReportSource = report1
report1.DiscardSavedData
CRViewer91.ViewReport
CRViewer91.Zoom 94
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub
ERROR: 'null Report show. How come?
Why the command below is not recognise by my vb6.0? izit bcos i forget to declare of it?
CRP1.DataFiles(0) = DataSource
CRP1.ReportFileName = App.Path & "\Reports\" & FileName
CRP1.WindowTitle = title
CRP1.Destination = Destination
CRP1.WindowState = crptMaximized
CRP1.Action = crptToWindow
I already create a beautiful design and full record crystal report, i just wish to use vb to activate/pass parameter to the cystalreport's SELECTIONEXPERT to generate seperate account of report, can i?
Thanks~