Error - The specified varXmlToEdit value for the View.ExecuteAction call is not valid - InfoPath Dev
in

InfoPath Dev

Error - The specified varXmlToEdit value for the View.ExecuteAction call is not valid

Last post 06-04-2007 02:18 AM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-10-2007 05:51 PM

    Error - The specified varXmlToEdit value for the View.ExecuteAction call is not valid

    Hello All

    I am new to using InfoPath; however I have com a long was with the help of a couple of books.  I am now to the point that I am trying to write some code to perform a task when I click on a button.  I am using InfoPath 2007; however the template I am modifying must stay in version 2003 and not 2007.

     

    What I am trying to do is insert an Item into a repeating table.  This is for an order form and based on the type of order we have some standard entries that are always added.  I plan on have a dropdown box that the sales person will use to select the type of order and then click on a button that will automatically add in the items in to the repeating table.

     

    The code that I am trying to use is as follows:

    Public Sub QuoteType_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

          Me.CurrentView.ExecuteAction(ActionType.XCollectionInsert, "MRC_Items")

    End Sub

     

    When I click on the button I get the following error message

    System.Runtime.InteropServices.COMException

    The specified varXmlToEdit value for the View.ExecuteAction call is not valid.

       at Microsoft.Office.Interop.InfoPath.SemiTrust.View.ExecuteAction(String bstrAction, Object varXmlToEdit)

       at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.ExecuteAction(String bstrAction, Object varXmlToEdit)

       at Microsoft.Office.InfoPath.Internal.ViewHost.ExecuteAction(ActionType action, String xmlToEdit)

       at Quote1.FormCode.QuoteType_Clicked(Object sender, ClickedEventArgs e)

       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)

       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

     

    My Data source is as follows:

    custForm

                    MRC

                                    MRC_Items

                                         QtyMRC

                                         descriptionMRC

                                         UnitCostMRC

                                         ExtCostMRC

                                         WholesaleMRC

                    MRCFilter

     

     

    The MRC is the group and MRC_Items is the repeating table.

     

    What am I doing wrong?

     

    Thank you all for any help you can give me

    Steve

  • 06-04-2007 02:18 AM In reply to

    Re: Error - The specified varXmlToEdit value for the View.ExecuteAction call is not valid

    Hello Steve and welcome to the forums!

    The ExecuteAction() method is shaky at best - it has a lot of dependencies on view state, user context, and a lot of other things.  It is usually best to implement these functions on your own. To insert a new row in the repeating section you need to do this:

    1. Load the template.xml or sampledata.xml into a IXMLDOMDocument2 object
    2. Select the node that you want to insert, and create clone of it using cloneNode()
    3. On the parent node (the group that contains all of the repeating children), call appendChild() to append the copy of the node from template or sampledata

    Good luck, and let us know if you need any more help!

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.