Hi,
I've got the following which works fine: -
VB Code:
Option Explicit Dim m_adoCnn As New ADODB.Connection Dim m_adoRst As New ADODB.Recordset Dim CRXApp As New CRAXDRT.Application Dim CRXRpt As CRAXDRT.Report Dim CRXDB As CRAXDRT.Database Private Sub Command1_Click() m_adoRst.Close m_adoRst.Open "Select * From TB_Customers", m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText CRXDB.SetDataSource m_adoRst, 3, 1 CRViewer91.Refresh End Sub Private Sub Form_Load() m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=Password;User ID=User;Data Source=tcpos" m_adoCnn.Open m_adoRst.Open "Select * From TB_Customers where code = 901", m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText Set CRXRpt = CRXApp.OpenReport("C:\report2.rpt", 1) Set CRXDB = CRXRpt.Database CRXDB.SetDataSource m_adoRst, 3, 1 CRViewer91.EnableGroupTree = False CRViewer91.EnableAnimationCtrl = False CRViewer91.ReportSource = CRXRpt CRViewer91.ViewReport End Sub
As I've said the above works fine when running a report based on one table. I've tried the same but with a report that uses more than one table and get the following error when run: -
VB Code:
Cystal Report Viewer Logon Failed. Details: ADO Error Code: 0x80040e4d Source: Microsoft OLE DB Provider for Oracle Description: ORA-01017: invalid username/password; logon denied Native Error: 1017
Changed Code with error: -
VB Code:
Private Sub Form_Load() Dim strSQL As String m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=Password;User ID=User;Data Source=tcpos" m_adoCnn.Open strSQL = "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" m_adoRst.Open strSQL, m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText Set CRXRpt = CRXApp.OpenReport("C:\Test.rpt", 1) Set CRXDB = CRXRpt.Database CRXDB.SetDataSource m_adoRst, 3, 1 CRViewer91.EnableGroupTree = False CRViewer91.EnableAnimationCtrl = False CRViewer91.ReportSource = CRXRpt CRViewer91.ViewReport End Sub
I've looked at the code an the error occurs on 'CRViewer91.ViewReport'.
Has anyone got any ideas or if what I'm trying to do isn't possible?


Reply With Quote