I am using the ExecuteAction to insert an optional section, if a specific value is selected in a drop down menu (note the optional section is in a repeated section). First time the drop down value matches it inserts the optional section with out a problem but if I remove the section and then try to reselect the value in the drop down menu it gives me the following error
"The attempted fragment operation cannot be completed because there is no valid insertion point for the fragment."
and then it still inserts the section....How can I get rid of this error...
Code Below
<InfoPathEventHandler(MatchPath:="/mstns:SHORT_SEARCH/mstns:INSTRUMENT/mstns:INST_NAME", EventType:=InfoPathEventType.OnAfterChange)> _
Public Sub INST_NAME_OnAfterChange(ByVal e As DataDOMEvent)
If thisXDocument.DOM.getElementsByTagName("mstns:INST_NAME").Item(0).text = "DEED" Then
thisXDocument.View.ExecuteAction("xOptional::insert", "DEED_30")
End If
End Sub