Results 1 to 4 of 4
  1. #1
    MatthewNYC is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2018
    Posts
    2

    Why Does Excel 2013 Crash When VBA Creates Connection To Access 2016 Database?

    Hi,




    I am running the following software:


    Windows 7 (64 bit)
    Excel 2013 (32 bit)
    Access 2016 (32 bit)


    When I use the following VBA code to connect Excel 2013 to my Access 2016 database, Excel immediately crashes:


    ---- begin ----
    Dim objConn As ADODB.Connection
    Dim strDBConnection As String


    strDBConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Me\Documents\MyAccessDB.accdb;Pers ist Security Info=False;"


    Set objConn = CreateObject("ADODB.Connection")
    objConn.Open strDBConnection
    ---- end ----


    I then tried using LATE binding and unchecking the reference to "Microsoft ActiveX Data Objects 6.1 Library" in Excel 2013 and ran this code:


    ---- begin ----
    Dim objConn As Object
    Dim strDBConnection As String


    strDBConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Me\Documents\MyAccessDB.accdb;Pers ist Security Info=False;"


    Set objConn = CreateObject("ADODB.Connection")
    objConn.Open strDBConnection
    ---- end ----


    In this case Excel does not crash but reports the following error:


    Method 'Open' of object '_Connection' failed


    I read some message board posts that recommended installing:


    Microsoft Access Database Engine 2016 Redistributable
    https://www.microsoft.com/en-us/down....aspx?id=54920


    However, this did not solve the problem.


    I even tried using just about every connection string for Access from ConnectionStrings.com but none of them work.


    From what I've read in the message boards (but didn't understand completely) the problem may have something to do with the fact that my Windows 7 is 64 bit and the Excel and Acess I am using are 32 bit.


    My BIG concern is that I am developing a commercial Excel spreadsheet and now I'm wondering what problems my users will experience with the software depending on their version of Windows, Microsoft Office, and whether both (or one) are 32 or 64 bit.


    Is there any Access Guru out there that has this all figured out?


    Matthew

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Is ADODB loaded in References?
    (VBE menu, tools, references)

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    MatthewNYC is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2018
    Posts
    2
    Hi,
    Thank you for trying to help.

    In Excel / VBE Editor / References, I unchecked the box for:

    Microsoft Office 15.0 Object Library

    Then, when I went to recheck it, I now saw it had changed to 16.0:

    Microsoft Office 16.0 Object Library

    I'm assuming this is because I installed Access 2016.

    The VBA code now makes the connection without raising any errors.

    However, when I attempt to create a simple recordset object I get this error:

    Method 'Execute' of object '_Connection' failed.

    Here is the code:

    SQL = "SELECT * FROM settings"

    Set rs = objConn.Execute(SQL)

    So, now I am stuck trying to execute queries.

    Matthew

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access 2016 sendobject crash
    By Gail in forum Access
    Replies: 15
    Last Post: 01-08-2020, 10:27 AM
  2. Access 2013 won't open a 2016 Database
    By whisp0214 in forum Access
    Replies: 2
    Last Post: 08-22-2017, 01:53 PM
  3. DAO Connection in Excel to Access 2016
    By AME in forum Import/Export Data
    Replies: 5
    Last Post: 12-01-2016, 02:41 AM
  4. Replies: 2
    Last Post: 07-24-2016, 09:49 PM
  5. Replies: 2
    Last Post: 06-19-2016, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums