Why Can't I CoCreateInstance a DAO.DBEngine.120 Object (Access 2016)? RRS feed

  • Question

  • I have 64-bit Microsoft Access 2016 installed (Office 365), and I'm trying to create an instance of DAO.DBEngine.120, as follows:

    const GUID IID_DBEngine =
    	{ 0x00000021, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xAA, 0x00, 0x6D, 0x2E, 0xA4 } };
    LPDISPATCH pDbEngine;
    HRESULT hResult;
    GUID lpDbClsid;
    hResult = CLSIDFromProgID(L"DAO.DBEngine.120", &lpDbClsid);
    hResult = CoCreateInstance(lpDbClsid, NULL, CLSCTX_INPROC_SERVER, IID_DBEngine, (void**)&pDbEngine);

    However, CLSIDFromProgID returns "Invalid Class String", and lpDbClsId is all zeros.  Note: for good measure, I've tried running this code in both 64-bit and 32-bit mode, although I know it should be run as 64-bit, since that's the Access version I have installed.

    Now, if I change the ProgID to DAO.DBEngine.36, and run it in 32-bit, it works as expected (though obviously I can't open an .accdb database).

    I can create the object using VBA's CreateObject("DAO.DBEngine.120"), but I can't create it with VBScript's CreateObject.

    Looking at the way DAO.DBEngine.120 is entered into the registry, it's obvious that it isn't registered like a "normal" COM object:

    @="Microsoft Office 12.0 Access Database Engine DBEngine"
    "Assembly"="Microsoft.Office.Interop.Access.Dao, Version=, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
    "Assembly"="Microsoft.Office.Interop.Access.Dao, Version=, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"

    Some things I've noticed:

    1. Obviously, the registration isn't under HKCR\CLSID.
    2. There is no default value for InProcServer32 (so, how would it be activated?).
    3. The "Assembly" appears to refer to the .NET Office Primary Interop Assemblies, registered in the GAC, which doesn't make much sense to me.

    So, is it possible to create an instance of DAO.DBEngine.120 outside of Microsoft Office using CoCreateInstance or similar, or is this some sort of "special" COM registration?

    • Edited by Transistor1 Monday, January 30, 2017 7:22 PM
    Monday, January 30, 2017 6:28 PM


All replies

  • This sounds like the "Click To Run" application bubble that was described at

    • Edited by RLWA32 Monday, January 30, 2017 6:46 PM
    • Marked as answer by Transistor1 Monday, January 30, 2017 6:49 PM
    Monday, January 30, 2017 6:45 PM
  • Thanks! I think you are right-- I wasn't aware of this; thanks for pointing it out.

    Monday, January 30, 2017 6:50 PM
  • Hi
    I'm aware this thread is from 2017, but I am experiencing this exact problem (dao.dbengine.120.dll not exposed in CTR Office installations) and my research online did not produce good results. This discussion was the most promising, so I hope maybe someone found how to solve this without to have to install legacy packages?

    Wednesday, February 6, 2019 1:16 PM
  • I have the same issue, only workaround I have is to install the 2007 database engine x86 next to the 2010 x64. 2010 x64 version works for compilation time while 2007 x86 is runtime on AnyCPU configuration. I think it should work either with 2010 or 2016 database engine x64 but it doesn't. Anyone? I cannot hit the right answer

    Luis Genaro Arteaga Salinas

    Tuesday, September 3, 2019 2:24 PM
  • Hi Luis,

    I'm faced with this problem since more than 2 years and found no solution, except the runtime version of access 2013 as a parallel install.

    Did you made any progress?


    Thursday, October 31, 2019 10:29 AM
  • Yes, please, Microsoft, could you solve this!?
    Thursday, October 31, 2019 12:58 PM