Im using Crystal report 8 and VB6, my problem is how can i make the Crystal report get the record from the recordset i made. The problem is when i run the report it shows all the record from the table. How can i make the report show only the content of the recordset?
Below is the code im using. dcCategory is datacombo.
When i design the report using crystal report designer i use the table as the datasource and i did not set anything else. Could this be the problem?
Thanks in advance!!!
Below is the code im using. dcCategory is datacombo.
Code:
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open "File name=c:\Product.udl"
Set rst = cnn.Execute("select item_no,item_category,Item_desc,Item_unit,item_price from tblitems where item_Category ='" & dcCAtegory.Text & "'")
Dim crystal As CRAXDRT.Application
Dim treport As CRAXDRT.Report
CRViewer1.DisplayBorder = False
CRViewer1.DisplayTabs = False
CRViewer1.EnableDrillDown = False
CRViewer1.EnableRefreshButton = False
Dim crxApplication As New CRAXDRT.Application
Set crystal = New CRAXDRT.Application
Set treport = crystal.OpenReport("d:\application\list.rpt")
treport.DiscardSavedData
treport.Database.SetDataSource rst
CRViewer1.ReportSource = treport
CRViewer1.ViewReport
When i design the report using crystal report designer i use the table as the datasource and i did not set anything else. Could this be the problem?
Thanks in advance!!!