+ Reply to Thread
Results 1 to 5 of 5

Run time error:'-2147217900(80040e14)':

  1. #1
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Run time error:'-2147217900(80040e14)':

    I am trying to import data from MYSQL database to excel Sheet but i am getting this error


    {MySQL][ODBC 5.2(w) Driver][mysqld-5.6.16-log] you have an error in
    your Sql syntax; check the manual that corresponds to your MYSQL
    server version for the right syntax to use near 'FROM where FQR_User_Code='usman' and line_status in('QP')
    order by line_status' at line 1

    <code> 'Create the connectionstring.
    strConn = "Driver=MySQL ODBC 5.2 Unicode Driver;" _
    & "Data Source=" & stDB & ";"

    'The 1st raw SQL-statement to be executed.
    stSQL1 = "SELECT * FROM tblbatch_headers where idBatch " & batchID & "order by col_seq asc"

    'The 2nd raw SQL-statement to be executed.
    stSQL2 = "SELECT " & dataStr & " FROM " & prdTblName & " where FQR_User_Code='" & Application.username & _
    "' and line_status in('QP') order by line_status"

    'Clear the worksheet.
    Sheet1.Range("A1").CurrentRegion.Clear

    With cnt
    .Open (strConn) 'Open the connection.
    .CursorLocation = adUseClient 'Necessary to disconnect the recordset.
    End With

    With rst1
    .Open stSQL1, cnt 'Create the recordset.
    Set .ActiveConnection = Nothing 'Disconnect the recordset.
    End With

    With rst2
    .Open stSQL2, cnt 'Create the recordset. it shows this line
    Set .ActiveConnection = Nothing 'Disconnect the recordset.
    End With</code>

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Run time error:'-2147217900(80040e14)':

    Can you post the full SQL statements?

    Also, have you checked the statements in MySQL Workbench?

    PS It's square brackets for code tags.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run time error:'-2147217900(80040e14)':

    Please Login or Register  to view this content.
    yes i checked in mysql workbench

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Run time error:'-2147217900(80040e14)':

    Eh, I actually meant the SQL statement with all the values from the variables substituted.

    You can output that to the Immediate Window (CTRL+G) by adding this just before you try to open the recordset.
    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    Pretty sure the problem is with the SQL, perhaps you are using quotes in the wrong places.

+ 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. Cannot Publish Excel Pivot Chart - Run Time Error
    By crisb184 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2013, 07:04 AM
  2. Error -2147217900: [Microsoft][ODBC Excel Driver] <tablename$> is NOT a valid name
    By basubdd in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-06-2013, 11:34 AM
  3. [SOLVED] Run-time error '-2147217900(80040e14)': Automation error
    By Lloyd Blankfein in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2012, 06:54 AM
  4. run-time error ;2147023179 (800706b5) time automation error interface unknown
    By karthik72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 09:31 AM
  5. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM

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