BUG: "Attempt to Access the Method Failed" Error Message When You Use a Reference to the Wrong Microsoft Forms 2.0 Object Library (824009)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Office Professional Edition 2003
- Microsoft Visual Studio Tools for the Microsoft Office System
SYMPTOMSIn a Visual Studio .NET project that contains a reference to the Microsoft Forms 2.0 Object Library, you may receive an error message similar to the following: System.MethodAccessException: "Attempt to access the method failed." CAUSEWhen you use the Add Reference dialog box to add a reference to the Microsoft Forms 2.0 Object Library, you may notice that two entries appear for Microsoft Forms 2.0 Object Library. Both of these entries refer to the FM20.dll file.
You must select the first Microsoft Forms 2.0 Object Library entry in the list because this is the Primary Interop Assembly (PIA) reference. If you select the second Microsoft Forms 2.0 Object Library entry, your application may not behave as expected.RESOLUTIONTo resolve this problem, follow these steps: - In Solution Explorer, right-click the MSForms reference, and then click Remove.
- In Solution Explorer, right-click References, and then click Add Reference.
The Add Reference dialog box appears. - In the Add Reference dialog box, click the COM tab.
- In the list of components, click the first entry that is named Microsoft Forms 2.0 Object Library.
Note This should be the PIA version. If only one Microsoft Forms 2.0 Object Library entry appears in the Add Reference dialog box, and this entry is not the PIA version, you must first install the PIA from the Microsoft Office System 2003 CD-ROM. - Click Select to add the entry to the list of selected components.
- Click OK to close the Add Reference dialog box.
- In Solution Explorer, click the MSForms reference that you added in step 5. Verify that the Copy Local property is set to False, and that the Path property is pointing to the PIA (as described in the "More Information" section).
- Delete the old Interop.MSForms.dll file from the Obj folder that is located your application folder.
Modification Type: | Minor | Last Reviewed: | 1/15/2004 |
---|
Keywords: | kberrmsg kbBug kbPIA kbnofix KB824009 kbAudDeveloper |
---|
|