+ Reply to Thread
Results 1 to 2 of 2

Excel VBA: SQL Connection Error (run-time error 2147217843 login failed"

  1. #1
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Excel VBA: SQL Connection Error (run-time error 2147217843 login failed"

    It is excel VBA issue.

    If I use Sybase connection string (another database from same screenshot of ODBC Data Source), and the code works fine.

    But if I use the code for SQL Server, it returns error, see attached screenshot. I am sure that Server name and Database name are correct. Connection string looks correct too ( https://www.connectionstrings.com/mi...or-sql-server/ ). Did I use the correct connection string (standard security)? What could cause such error?

    I am not an IT professional, so not sure why it has error. Is it because of database setting? Is it because it does not allow User/Password access? How does SQL server setting work? Or some kind of Excel reference?

    I can manually use excel to connect the database and copy data to excel, see screenshot. So I do have the access to database.

    Thanks.

    Additional note: is it related to Microsoft Office? My workplace microsoft office may be 32 bits (not sure), while the database is 64 bits? Not an IT, don't know much about it. The reason I say this: when I use Access > External Data > ODBC Database to connect to the database, it shows 32 bit for the database. But when I am ODBC Data Source, it shows 64 bits, since it is 64 bit laptop.

    Please Login or Register  to view this content.
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Excel VBA: SQL Connection Error (run-time error 2147217843 login failed"

    Disclaimer: I don't use SQL Server, so I have no specific 1st hand experience with it.

    If your employer has SQL Server databases, presumably it also has an IT department. You might want to ask them whether there are any policies for SQL Server access which prohibit automated access, so only allow for manual, interactive access. If that's the case, and IT isn't willing to make an exception for you, then manual interactive access would be your only alternative. Better to find that out up front before spending more time trying to automate this.

    OTOH, if IT does permit automated access, they'd almost certainly be able to provide more comprehensive details for doing so within your workplace environment than ANYONE here could give you.

    Sometimes in-house resources should be your 1st recourse.

+ 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. run-time error '.2147217843 (80040e4d)' when connecting to SQL server
    By Lucho Pedano in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-13-2022, 02:50 AM
  2. RUN-TIME ERROR Method "ExecWB" of object 'IWedBrowser 2' failed
    By dgarber in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2020, 12:15 PM
  3. Excel macro Run-time error '1004': Method 'Range' of object'_Global" failed
    By rlagreid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2019, 09:08 AM
  4. Replies: 0
    Last Post: 10-20-2014, 05:33 PM
  5. "Run-time error 1004" paste method of worksheet class failed
    By Ghostturd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2013, 10:21 PM
  6. Replies: 3
    Last Post: 01-08-2013, 10:36 AM
  7. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM

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