Select the product you need help with
BUG: "Attempt to Access the Method Failed" Error Message When You Use a Reference to the Wrong Microsoft Forms 2.0 Object LibraryArticle ID: 824009 - View products that this article applies to. 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:
MORE INFORMATIONWhen you use a reference to the PIA version of the Microsoft Forms 2.0 Object Library, you will notice the following properties for the MSForms reference in Solution Explorer:
If the reference to the Microsoft Forms 2.0 Object Library was added incorrectly (or if the PIA is not installed), the properties of MSForms appear as follows:
If your solution uses the wrong MSForms reference, you may experience problems when you try to use objects from this library. For example: You try to use the FindControl function in an Excel workbook project that was created by using the Visual Studio Tools for the Microsoft Office System. (Typically, you might do this to capture the Click event of a CommandButton control in the worksheet.) If the solution uses the wrong MSForms reference, the Click event of the CommandButton control does not fire when the user clicks the button on the worksheet, although no errors appear to have occurred in the code. If you use an exception handler when you try to assign your CommandButton object, you receive the error message that appears in the "Symptoms" section. Properties |


Back to the top








