locked
Connection String for Access 2016 RRS feed

  • Question

  • Hello,

    I was using Provider=Microsoft.ACE.OLEDB.12.0 to connect my Access 2013 .accdb file.

    once when we upgrade to Access 2016 this provider is not working.

    I tried Microsoft.ACE.OLEDB.16.0 provider this also not working.

    so please provide me a good working connection string to connect my Access 2016 .accdb files.

    Thank and regards,

    Abdul Haseeb.

    Wednesday, February 15, 2017 6:17 AM

All replies

  • Microsoft.ACE.OLEDB.12.0 is the latest version. What is the error you are getting when attempting to open the database? Below is a link to connection string examples:

    https://www.connectionstrings.com/access/

    Also, keep in mind that there are both 32-bit and 64-bit versions of the provider, so you need to make sure that your app is running 32-bit for the 32-bit version or 64-bit for the 64-bit version.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 15, 2017 1:11 PM
  • I'm actually having issues making a OleDbConnection to an Access database as well.  I've tried the original old .mdb database file, then I tried with a new .accdb file.  I tried using Microsoft.ACE.OLEDB.12.0 provider as well as Microsoft.Jet.OLEDB.4.0 with the same type of exception message:

    'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.'

    The code compiles with no issues but it throws the exception at runtime when I execute the .Open() method.  I assume I'm missing a reference or something.  Any idea as to what it could be?  It is a C#.NET 64 bit  application running .NET 4.7.

    Monday, December 9, 2019 4:24 PM
  • Hi Abdul,

    I am experiencing problems similar to your own with Microsoft Access accdb files.

    Can you post the correct connection string for Microsoft Access 2016 accdb file,  if you have it.

    Thank you very much 

    Gary

    Tuesday, December 29, 2020 1:46 PM
  • You should be able to use code like this:

        Dim cnn As ADODB.Connection
        Set cnn = New ADODB.Connection
        cnn.Open ConnectionString:="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;Persist Security Info=False;"

    Substitute the actual path and filename.


    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    • Proposed as answer by KHURRAM RAHIM Friday, January 1, 2021 7:32 AM
    Tuesday, December 29, 2020 2:45 PM
  • Thanks so much Hans,

    However I am attempting to set a connection within Visual Studio 2015, under

    Shared Data Sources

    Add New Data Source

    I select ODBC as the Data Source Type

    When I add the following string

    Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\Control Room Incident Database\\My_Test3.mdb

    I connect to the Microsoft Access mdb database.

    However the following string does NOT connect to a Microsoft Access accdb database.

    Driver={Microsoft Access Driver (*.mdb , *.accdb )};DBQ=c:\\Control Room Incident Database\\My_Test4.accdb

    Any help with this would be much appreciated.

    Thanks again 

    Gary

    Tuesday, December 29, 2020 3:18 PM
  • How about

    Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\Control Room Incident Database\My_Test4.accdb;Uid=Admin;Pwd=;


    Regards, Hans Vogelaar (https://www.eileenslounge.com)


    Tuesday, December 29, 2020 7:49 PM
  • Thansk again for you suggestion
    Tuesday, December 29, 2020 10:39 PM
  • After trying the connection string I received the following errors

    ERROR [HY000]

    ERROR [IM006]

    I will strive to find a solution to these.

    Tuesday, December 29, 2020 10:41 PM