I try to create report using Crystal report viewer 9 ,MS SQL and VB6. I designed the report as Picture "CR1". My code is,
Option Explicit
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report

Private Sub Print_Click()

   Set Appl = New CRAXDRT.Application
   Set Report = Appl.OpenReport(App.Path & "\Bill1.rpt")
   Set rs = New ADODB.Recordset
   strReso = "SELECT BI_BILLNO,IM_Description,IM_SPrice,BI_QUANTITY,BI_AMOUNT " + _
   "From BILLITEM,ITEMMASTER Where BI_BILLNO = " + Trim(txtBillNo.Text) + _
   " and BI_ITEMCODE = IM_ItemCode"
   rs.Open strReso, conMain, adOpenStatic, adLockReadOnly
   Report.ParameterFields.GetItemByName("BillNo").AddCurrentValue txtBillNo.Text
   Report.Database.SetDataSource rs
   CRViewer91.ReportSource = Report

End Sub
Connection String is "str1 = "Provider=SQLOLEDB.1;User ID = hemantha; Password=19760207;Initial Catalog=Waruni_Sale_System;Data Source=""

It is working. But, when I used two tables as Picture "CR2", occur a error message as Picture "Err". The report is working in Crystal Report. As "Preview".
What is the wrong? Anyone can help? Attachment 160365Attachment 160367Attachment 160369Name:  Preview.jpg
Views: 595
Size:  36.8 KB