Microsoft.Office.Interop.Access.Form

  • Thread starter Thread starter Evan Camilleri
  • Start date Start date
E

Evan Camilleri

i opened a form using DoCmd, then I used

Microsoft.Office.Interop.Access.Application MSAccess = new
Microsoft.Office.Interop.Access.Application();
MSAccess.OpenCurrentDatabase(....);
MSAccess.DoCmd.OpenForm("formname",...);
Microsoft.Office.Interop.Access.Form f = MSAccess.Forms["formname"];

..........and I get some COM error!!!

"Unable to cast COM object of System.__ComObject to interface type
'Microsoft.Office.Interop.Access.Form'. The operation failed because the
QueryInterface call on the COM components for the ...."


Evan Camilleri







http://www.holisticrd.com
http://www/dotnetmushroom.com
http://www.mobilesalesman.com
 
On Sat, 2 Aug 2008 13:37:09 +0200, "Evan Camilleri"

I think this is incorrect use of Interop. You may want to use
CreateObject("Access.Application").

-Tom.
Microsoft Access MVP
 
Why? I mean there is a Forms collection, and a Form class with a Controls
collection!

In any case, I'll go the 'old' object style method :(

thanks

--
Evan Camilleri
http://www.HolisticRD.com
http://www.DotNetMushroom.com
http://www.MobileSaleman.com



Tom van Stiphout said:
On Sat, 2 Aug 2008 13:37:09 +0200, "Evan Camilleri"

I think this is incorrect use of Interop. You may want to use
CreateObject("Access.Application").

-Tom.
Microsoft Access MVP

i opened a form using DoCmd, then I used

Microsoft.Office.Interop.Access.Application MSAccess = new
Microsoft.Office.Interop.Access.Application();
MSAccess.OpenCurrentDatabase(....);
MSAccess.DoCmd.OpenForm("formname",...);
Microsoft.Office.Interop.Access.Form f = MSAccess.Forms["formname"];

.........and I get some COM error!!!

"Unable to cast COM object of System.__ComObject to interface type
'Microsoft.Office.Interop.Access.Form'. The operation failed because the
QueryInterface call on the COM components for the ...."


Evan Camilleri







http://www.holisticrd.com
http://www/dotnetmushroom.com
http://www.mobilesalesman.com
 
Back
Top