OnAfterChange firing multiple times after query with repeating sec

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.
However, 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....
 
R

RickH

I added this code--query doesn't fail, but , after more testing, I found that
if I changed the second record returned, it 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
 
R

RickH

Anyone have any ideas?
I had to post the code as is with a note saying to only make changes after
modifying the query to return only 1 record.
Kinda kludgy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top