access automation no longer working in 4.0 framework

0

I have an application that opens up microsoft access performs some automation, then closes. This worked fine when using 4.5 framework. But now the application has to work on xp machines which only supports 4.0 framework. When i changed the application target framework to 4.0, i get this error which i haven't been able to figure out.

Additional information: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Access.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{68CCE6C0-6129-101B-AF4E-00AA003F0F07}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))

Microsoft.Office.Interop.Access.Application oAccess = null;
oAccess = new Microsoft.Office.Interop.Access.Application(); // error occurs here.

i'm at a loss as to what exactly this means and how to fix it.

c#
.net
ms-access
asked on Stack Overflow May 6, 2014 by tchadwik

1 Answer

0

Ended up figuring out the problem, the target platform needed to be specified to 32bit. Having set to any didn't work in 4.0 framework but does work in 4.5 framework.

answered on Stack Overflow May 7, 2014 by tchadwik

User contributions licensed under CC BY-SA 3.0