R
RickH
Using VB.Net
I query a SQL table to populate a repeating section.
If a user changes a value in a dropdown listbox, I use OnAfterChange to
change another value in the current record. That seems to work fine for only
the first record.
Also, when I run the query, the OnAfterChange fires many times as the
query returns records.
I want the OnAfterChange to only execute my code when a user changes a
specific record and to act only on that record....
added this code--query doesn't fail, but , after more testing, I found that
if I changed the second record returned, it still didn't work.
<InfoPathEventHandler(MatchPath:="/dfs:myFields/dfs:dataFields/d:Offload_Request/@LocationID", EventType:=InfoPathEventType.OnAfterChange)> _
Public Sub Offload_Request_LocationID_attr_OnAfterChange(ByVal e As
DataDOMEvent)
' Write code here to restore the global state.
If (e.IsUndoRedo) then
' An undo or redo operation has occurred and the DOM is read-only.
Return
End If
' A field change has occurred and the DOM is writable. Write code here to
respond
' to the changes.
'If FacilityID changes, LocationOffloadCode should be changed to
Null, so sproc can reassign correct code
Dim myLocationOffloadCode As IXMLDOMNode
If e.Operation = "Insert" Then
Try
myLocationOffloadCode =
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Offload_Request/@LocationOffloadCode")
myLocationOffloadCode.text = Nothing
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
End Sub
I query a SQL table to populate a repeating section.
If a user changes a value in a dropdown listbox, I use OnAfterChange to
change another value in the current record. That seems to work fine for only
the first record.
Also, when I run the query, the OnAfterChange fires many times as the
query returns records.
I want the OnAfterChange to only execute my code when a user changes a
specific record and to act only on that record....
added this code--query doesn't fail, but , after more testing, I found that
if I changed the second record returned, it still didn't work.
<InfoPathEventHandler(MatchPath:="/dfs:myFields/dfs:dataFields/d:Offload_Request/@LocationID", EventType:=InfoPathEventType.OnAfterChange)> _
Public Sub Offload_Request_LocationID_attr_OnAfterChange(ByVal e As
DataDOMEvent)
' Write code here to restore the global state.
If (e.IsUndoRedo) then
' An undo or redo operation has occurred and the DOM is read-only.
Return
End If
' A field change has occurred and the DOM is writable. Write code here to
respond
' to the changes.
'If FacilityID changes, LocationOffloadCode should be changed to
Null, so sproc can reassign correct code
Dim myLocationOffloadCode As IXMLDOMNode
If e.Operation = "Insert" Then
Try
myLocationOffloadCode =
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Offload_Request/@LocationOffloadCode")
myLocationOffloadCode.text = Nothing
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
End Sub