+ Reply to Thread
Results 1 to 4 of 4

Recordset issue with connection to Oracle

Hybrid View

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    46

    Recordset issue with connection to Oracle

    Hello all,

    I am connecting to oracle and trying to pull data into an excel spreadsheet, however, I am getting an error when I try to use the recordset object. The error is Run-time error -2147217900 (80040e14)': Automation Error

    Here is the code up too the line that causes an error

    
    Sub GetOracleData()
    
    ' requires a reference to the Microsoft ActiveX Data Objects Library.
    
        Dim cn                    As ADODB.Connection
        Dim rst                   As ADODB.Recordset
        Dim strQuery              As String
        Dim TR                    As Range
        Dim lngFieldCount         As Long
        Dim i                     As Long
    
        Application.ScreenUpdating = False
    
        Set TR = Range("A1")
        Set TR = TR.Cells(1, 1)
        Set cn = New ADODB.Connection
        With cn
           ' .Provider = "OraOLEDB.Oracle"
           .Provider = "MSDAORA.Oracle"
            .ConnectionString = "Data Source=xxxxx;User ID=xxxxxxx;Password=xxxxxxxx; "
            .Open
        End With
        strQuery = "SELECT * FROM awesome;"
        Set rst = New ADODB.Recordset
    '    Set rst = Connection.Execute("select * from awesome;")
    
        rst.Open strQuery, cn

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Recordset issue with connection to Oracle

    Does it make any difference if you remove the semicolon from the end of the SQL string? I assume you have access rights to that table?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    08-08-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Recordset issue with connection to Oracle

    Well what do you know! I never would have thought the semicolon would cause an issue!

    Thanks!

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Recordset issue with connection to Oracle

    Glad to help.

    Please don't forget to mark the thread Solved using the Thread Tools link at the top of the page.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel to Oracle connection using VBA for various oracle versions
    By pam79 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2012, 02:39 AM
  2. [SOLVED] VBA - Problem getting data from Oracle server using SQL query with Recordset
    By Dapos in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-16-2012, 09:58 PM
  3. ADO connection to Oracle
    By DaveF in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2010, 02:35 PM
  4. Oracle recordset to Excel
    By pm65151 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2008, 04:15 PM
  5. What is the fastest way to pull a recordset using ADO to Oracle.
    By Gummy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 05:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1