Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Report Modify at Runtime - Simple Crystal Example does not work!?

Status
Not open for further replies.

HDer

Technical User
May 3, 2001
8
CA
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
********************************************************
 
You started in the middle of the example and so you didn't create your report using the ADO driver. You can't pass a recordset to a report, unless it was designed to run with active data. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hi,

Is there anyone out there know how to use Crystal Report 8 in Visual Basic? Please help me!
 
You should start a new thread with a specific question. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top