Run a script against a field in a repeating section

MartePalmer
MartePalmer used Ask the Experts™
on
All,

Still a little new to programming in InfoPath.  I am trying to pull data from a repeating section.  I have done this successfully from a repeating table but when I try to do this from a repeating section, it fails saying:

The following error occurred:

Object required: 'oItem.selectSingleNode(...)'
File:script.vbs
Line:302

What do I need to change to get this to work for a repeating section instead of a repeating table?  

Dim firstname, lastname, unit 
 Dim objXMLNodes, oItem 
 Dim Outlook                              ' As New Outlook.Application 
 Dim Message                            ' As Outlook.MailItem 
 
set objXMLNodes = XDocument.DOM.selectNodes("//my:RecipientInfoRepeat")   '-- RecipientInfoRepeat 
 
if objXMLNodes.length <= 0 then 
     XDocument.UI.Alert("Please Add at leaste One (1) recipient to form before submitting.") 
    exit sub 
end if 
 
If objXMLNodes.length > 0 Then 
  For Each oItem In objXMLNodes 
       recipientid = oItem.selectSingleNode("my:LogonID").text 
       firstname = oItem.selectSingleNode("my:FirstName").text 
       lastname = oItem.selectSingleNode("my:LastName").text 
       employeetype = oItem.selectSingleNode("my:NonEmployee").text 
       location = oItem.selectSingleNode("my:Location").text 
       jobfunction = oItem.selectSingleNode("my:JobFunction").text 
       emailmessage = emailmessage + classaction + " Recipient --" + recipientid + "--" + lastname + "," & _ + firstname + "--" + employeetype + "--" + location + "--" + jobfunction + cr
next End If

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Found my problem.  By changing the line:

set objXMLNodes = XDocument.DOM.selectNodes("//my:RecipientInfoRepeat")

to

set objXMLNodes = XDocument.DOM.selectNodes("//my:RecipientInfo")

The parse now crawls the nodes.  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial