I'm trying to add a button to a form that will select all items in a multi-select list box. The list box itself is buried in a repeating section. I found this article and tried to modify it for my purposes. However, I'm getting the "InfoPath cannot open the selected form" error. I know my problem deals with the syntax that I've put in bold below, but I don't know how to change it. Any help is appreciated. Thanks.
Sub CTRL77_5_OnClick(eventObj)
Dim divisions(16)
divisions(0)="Canada"
divisions(1)="Corporate"
divisions(2)="ES&P (Clark)"
divisions(3)="ES&P (DIA)"
divisions(4)="ES&P (EM)"
divisions(5)="ES&P (SVS)"
divisions(6)="ES&P (TRS)"
divisions(7)="ES&P (Worksite)"
divisions(8)="INV"
divisions(9)="IS&R (Spread)"
divisions(10)="IS&R (TCM)"
divisions(11)="L&P (ADMS)"
divisions(12)="L&P (AFP)"
divisions(13)="L&P (LTC)"
divisions(14)="L&P (MNL)"
divisions(15)="L&P (Payout)"
divisions(16)="REI (TARe)"
For Each x in divisions
Dim root As XPathNavigator = MainDataSource.CreateNavigator()
Dim group1 As XPathNavigator = root.SelectSingleNode("//my:group1/my:Grp_Reporting_Period/my:Grp_Division", NamespaceManager)
Dim field1 As XPathNavigator = root.SelectSingleNode("//my:group1/my:Grp_Reporting_Period/my:Grp_Division/my:Division_Choice", NamespaceManager)
Dim newNode As XPathNavigator = field1.Clone()
newNode.SetValue(x) group1.AppendChild(newNode)
Next
End Sub