Important: Please read the Qt Code of Conduct -

How use MS Access database on 64bit program with 32bit Office

  • Good day to all! I’ve been sitting on this task for SOME time and I don’t like creating topics myself, but I don’t find another option :

    • My 64bit Windows program (Qt Creator 4.8.0, MinGW 64 compiler);
    • Target computer on 64bit Windows which may or may not include 32bit or 64bit Microsoft Office (any year);
    • Microsoft Access Database Engine 2010 (this version is needed - the file should work in 2010 version of the program).

    My program should have the ability to read and modify data in .mdb database.

    Current solution:
    Use QSqlDatabase and QODBC:

    QSqlDatabase m_db = QSqlDatabase::addDatabase("QODBC");
    m_db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=c:\\targetDB.mdb;");

    When 64bit Office and Access drivers are installed on the computer - everything works.
    However, if there is 32bit version of Office and Access - an error:
    [Driver Manager]Data source name not found, and no default driver specified QODBC3: Unale to connect

    • As far as I know, you can’t just install 64bit versions of MS Access drivers on PC with 32x office version;
    • But even if you do, it (spied here and here), when you try to connect / create a database or source data, an error pops up:
      alt text
    • Yes, I tried different options for the connection string;
    • I tried to Indicated a specific driver in the connection string - also did not help:
    m_db.setDatabaseName("DRIVER=С:\\*pathToAccesDrivers* \\ACEODBC.DLL;DBQ=c:\\targetDB.mdb;");

    So yeah, in total:

    • Is it possible to somehow use 64 drivers directly? Or correctly install both version (or 64x on 32x Office) Access Database Engine and use it?
    • Are there any other ways to work with .mdb files? I came across this code and the mention of some “CData Access Source”, but so far, I couldn't figure it out.
    • Any other ideas! Counting on you :>

  • There was no solution, I had to sweat with the 32x version, which is installed if the Office is same bitness.