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