Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2006

Tip: Looking for answers? Try searching our database.

OnAfterChange firing multiple times after query with repeating sec

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RickH - 07 Jan 2006 20:39 GMT
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....
RickH - 07 Jan 2006 20:58 GMT
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
RickH - 09 Jan 2006 20:26 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.