Hi,

I've got the following which works fine: -

VB Code:
  1. Option Explicit
  2.  
  3. Dim m_adoCnn As New ADODB.Connection
  4. Dim m_adoRst As New ADODB.Recordset
  5.  
  6. Dim CRXApp As New CRAXDRT.Application
  7. Dim CRXRpt As CRAXDRT.Report
  8. Dim CRXDB As CRAXDRT.Database
  9.  
  10. Private Sub Command1_Click()
  11.  
  12.     m_adoRst.Close
  13.     m_adoRst.Open "Select * From TB_Customers", m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText
  14.     CRXDB.SetDataSource m_adoRst, 3, 1
  15.     CRViewer91.Refresh
  16.  
  17. End Sub
  18.  
  19. Private Sub Form_Load()
  20.  
  21.     m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=Password;User ID=User;Data Source=tcpos"
  22.     m_adoCnn.Open
  23.  
  24.     m_adoRst.Open "Select * From TB_Customers where code = 901", m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText
  25.  
  26.     Set CRXRpt = CRXApp.OpenReport("C:\report2.rpt", 1)
  27.     Set CRXDB = CRXRpt.Database
  28.    
  29.     CRXDB.SetDataSource m_adoRst, 3, 1
  30.    
  31.     CRViewer91.EnableGroupTree = False
  32.     CRViewer91.EnableAnimationCtrl = False
  33.     CRViewer91.ReportSource = CRXRpt
  34.     CRViewer91.ViewReport
  35.  
  36. 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:
  1. Cystal Report Viewer
  2. Logon Failed.
  3. Details: ADO Error Code: 0x80040e4d
  4. Source: Microsoft OLE DB Provider for Oracle
  5. Description: ORA-01017: invalid username/password; logon denied
  6.  
  7. Native Error: 1017

Changed Code with error: -

VB Code:
  1. Private Sub Form_Load()
  2.  
  3.     Dim strSQL As String
  4.    
  5.     m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=Password;User ID=User;Data Source=tcpos"
  6.     m_adoCnn.Open
  7.  
  8.     strSQL = "SELECT TB_CASHREGS.DESCRIPTION, TB_TRANS_CARDS.LOAD_CASH, TB_TRANS_CARDS.SALDO_CASH, " & _
  9.                 "TB_CUSTOMERS.CARD_NUM, TB_CUSTOMERS.DESCRIPTION " & _
  10.                 "FROM TB_TRANSACTIONS, TB_CASHREGS, TB_CUSTOMERS, TB_TRANS_CARDS " & _
  11.                 "WHERE  TB_TRANSACTIONS.CASHREG_ID = TB_CASHREGS.ID " & _
  12.                 "AND TB_TRANSACTIONS.CARD_NUM = TB_CUSTOMERS.CARD_NUM " & _
  13.                 "AND TB_TRANSACTIONS.ID = TB_TRANS_CARDS.TRANSACTION_ID"
  14.    
  15.     m_adoRst.Open strSQL, m_adoCnn, adOpenDynamic, adLockPessimistic, adCmdText
  16.  
  17.     Set CRXRpt = CRXApp.OpenReport("C:\Test.rpt", 1)
  18.     Set CRXDB = CRXRpt.Database
  19.    
  20.     CRXDB.SetDataSource m_adoRst, 3, 1
  21.    
  22.     CRViewer91.EnableGroupTree = False
  23.     CRViewer91.EnableAnimationCtrl = False
  24.     CRViewer91.ReportSource = CRXRpt
  25.     CRViewer91.ViewReport
  26.  
  27. 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?