Link to home
Start Free TrialLog in
Avatar of MartePalmer
MartePalmerFlag for United States of America

asked on

Run a script against a field in a repeating section

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

ASKER CERTIFIED SOLUTION
Avatar of MartePalmer
MartePalmer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial