Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195

    Unanswered: ORA-02041 Error (Program Development)

    I am writing a program that is giving me some grief. I looked this error up but it doesn't make sense in the context being used. Here is my query:

    Code:
    Private Sub PopulateCompanyComboBox()
        'Create Recordset Selecting all Customer Names
        SQLQuery = "SELECT DISTINCT Cust FROM (" & _
                   "SELECT DISTINCT QUOTE_COMP Cust FROM QUOTES " & _
                   "UNION " & _
                   "SELECT CU_NAME Cust FROM CU@QSDB_PK1) " & _
                   "ORDER BY Cust"
        'MsgBox SQLQuery
        Set OraRec = New ADODB.Recordset
        OraRec.Open SQLQuery, OraCon1, adOpenStatic, adLockOptimistic, adCmdText
        If OraRec.RecordCount = 0 Then
            Exit Sub
            OraRec.Close
            Set OraRec = Nothing
        Else
            OraRec.MoveFirst
            cmbCustomer.Clear
            
            Do While Not OraRec.EOF
                cmbCustomer.AddItem OraRec!CU_NAME
                OraRec.MoveNext
            Loop
            OraRec.Close
            Set OraRec = Nothing
        End If
    End Sub
    The query is bolded. I can run this same query form SQL*Plus and everything goes smooth but something is happening that I'm not to sure of. Can someone help me out? Thanks, Jeremy
    Nothing better than a good ride.

  2. #2
    Join Date
    Jun 2003
    Posts
    34

    ORA-02041

    I think what u have here is a DBLink issue. Why don't u create a synonym for the Remote DB and then give appropriate grants and then use that synonym in ur code to call the remote table ?

  3. #3
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195
    That's a bit over my head. Why would the DBLink not work in code but work perfectly from SQL*Plus? I'd love to try your idea but I'd need some help. Thanks, Jeremy
    Nothing better than a good ride.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •