I’m having trouble deploying .NET application which uses Microsoft Access automation.
I’ve installed the Access 2007 Runtime and Primary Interop Assemblies (PIAs) on the target machine:
However, when I try to create the ApplicationClass:
Application access = new ApplicationClass();
I get the following exception:
Unhandled Exception: System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9} failed due to the following error: 80080005.
I’ve googled the error code and tried tweaking the security settings in dcomcnfg, to no avail.
Any ideas?
I don’t want to install the full version of Access due to the cost, and the runtime should at least be able to create an instance of the application, surely?
You can’t launch an automated instance of the access runtime. What happens is access does start up when the instance is created. However, because it is the runtime, access then shuts down. In other words, you HAVE to open a database for the runtime to stay open.
Since one can not supply the file name to open with automation, then the work around is to use the Shell() function. Launch a copy of ms-access via shell() and this allows you to supply the accDB or mdb file as a parameter in the shell command. Then, in your .net code, use the equivalent of a get object in place of create object.
So this same limitation exists for access developers when we attempt to automate ms-access in a runtime. You can’t create the instance in code. However, as above shows, you have to use Shell() due to the above limitation that the access runtime shuts down when launched without a file parameter.