1 Attachment(s)
CR & VB Not returning expected results?
I'm running a report within a VB wrapper. However the data returned isn't what's expected.
Attached is what I get returned when running the following code: -
VB Code:
Option Explicit
Dim crxApp As New CRAXDRT.Application
Dim CRXRpt As CRAXDRT.Report
Dim CRXDB As CRAXDRT.Database
Dim CRXTbl As CRAXDRT.DatabaseTable
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim crxReport As CRAXDRT.Report
Dim crxApp As CRAXDRT.Application
Dim crxTable As CRAXDRT.DatabaseTable
Dim sql As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set crxApp = New CRAXDRT.Application
Set crxReport = crxApp.OpenReport("C:\Test.rpt", 1)
sql = "SELECT TB_CASHREGS.DESCRIPTION, TB_TRANS_CARDS.LOAD_CASH, TB_TRANS_CARDS.SALDO_CASH, " & _
"TB_CUSTOMERS.CARD_NUM, TB_CUSTOMERS.DESCRIPTION " & _
"FROM TB_TRANSACTIONS, TB_CASHREGS, TB_CUSTOMERS, TB_TRANS_CARDS " & _
"WHERE TB_TRANSACTIONS.CASHREG_ID = TB_CASHREGS.ID " & _
"AND TB_TRANSACTIONS.CARD_NUM = TB_CUSTOMERS.CARD_NUM " & _
"AND TB_TRANSACTIONS.ID = TB_TRANS_CARDS.TRANSACTION_ID " & _
"AND TB_TRANSACTIONS.CARD_NUM = '1052'"
cn.Open "Provider=OraOLEDB.Oracle; Data Source=tcpos; User Id=lyons; Password=matrix;"
rs.Open sql, cn, adOpenKeyset
'now verify all tables within the report
For Each crxTable In crxReport.Database.Tables
With crxTable.ConnectionProperties
.Item("Provider") = "OraOLEDB.Oracle"
.Item("Data source") = "tcpos"
'.Item("Initial Catalog") = " " 'if none, use ""
.Item("User ID") = "lyons"
.Item("Password") = "matrix"
End With
Next
crxReport.DiscardSavedData
crxReport.Database.SetDataSource rs
CRViewer91.ReportSource = crxReport
CRViewer91.ViewReport
End Sub
This isn't the same as when run through crystal or when the query is run directly against the DB.
As can be clearly seen the records are just the first repeated.
Any idea what I've missed?
I've looked through the Crsytal help, but nothing, to be honest not the best on-line help :(
Any help would be appreciated.
Regards