I have tried the Crystal Reports 8 example of modifying a report in VB6 at runtime. The example is on page 53, 54 of the Crystal Reports 8 Developer Guide, using the Xtreme database, with the report "World Sales Report". By itself, the report lists data from various regions around the world, USA being one of them.
What I did was create a Crystal Report in VB by importing the Crytsal supplied "World Sales Report". Then I modified the form code as instructed in the manual, ran the form, and I get the same report with all regions, NOT just the USA region. The code does not seem to work for this type of report - WHY? Is there another way in VB I should or could use to manipulate reports?
Now, if I create my own report, with details section having the Region in there, this type of filtering seems to work. Can anyone tell me what is the difference, when this code will work, when it will not?
CODE FOR "World Sales Report"
*****************************************************
Dim Report As New CrystalReport1
Dim rs As New ADOR.Recordset
Private Sub Form_Load()
rs.Open "select * from customer where country = 'USA'", "Xtreme sample database"
Report.Database.SetDataSource rs
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
********************************************************
What I did was create a Crystal Report in VB by importing the Crytsal supplied "World Sales Report". Then I modified the form code as instructed in the manual, ran the form, and I get the same report with all regions, NOT just the USA region. The code does not seem to work for this type of report - WHY? Is there another way in VB I should or could use to manipulate reports?
Now, if I create my own report, with details section having the Region in there, this type of filtering seems to work. Can anyone tell me what is the difference, when this code will work, when it will not?
CODE FOR "World Sales Report"
*****************************************************
Dim Report As New CrystalReport1
Dim rs As New ADOR.Recordset
Private Sub Form_Load()
rs.Open "select * from customer where country = 'USA'", "Xtreme sample database"
Report.Database.SetDataSource rs
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
********************************************************