VBA code to add rows to nested repeating table - InfoPath Dev
in

InfoPath Dev

VBA code to add rows to nested repeating table

Last post 01-16-2016 09:57 AM by T-fat. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-14-2016 09:39 AM

    • T-fat
    • Not Ranked
    • Joined on 01-14-2016
    • Posts 2

    VBA code to add rows to nested repeating table

    InfoPath 2013:  I am trying to amend some code that I got from this site.  The original code allows for a number to be entered into a text box and then that number of rows are added to the repeating table. That works fine. However, when I try to use the same code for a repeating table nested in the original it only adds rows to the nested table in the last original row added. I hope that makes sense. I imagine that the code just needs to be amended so that it knows what row of the original table you are currently on. Any help is appreciated. I usually am able to solve these issues from other posts, but I am stumped on this one.


    Filed under: ,
  • 01-15-2016 12:59 PM In reply to

    Re: VBA code to add rows to nested repeating table

     Hi! How do you know which row in the parent repeating table your user wants to add rows to? Is the field with the number inside the repeating table? Or do they click a button that is in the repeating table? Your code is going to get the repeating child inside the first instance of the parent - but if this code runs on a button inside the parent, you can use e.Source to get "this" parent. So - let's say group4 is the parent repeating group and there is a button in there with code for inserting repeating rows into the child repeating group. Let's say the child group is group6.

    XPathNavigator test = e.Source.SelectSingleNode("my:group5/my:group6", NamespaceManager);

    If inside the clicked event for a button inside group4 would return the first instance of group6 inside the parent where the button was clicked (C# above, but you get the idea).

    Hope that helps! 

    Hilary Stoupa

  • 01-16-2016 09:57 AM In reply to

    • T-fat
    • Not Ranked
    • Joined on 01-14-2016
    • Posts 2

    Re: VBA code to add rows to nested repeating table

     I am using a button inside the repeating table.  Using your advice I was able to get this to work using the e.Source method.  I had tried it before unsuccessfully, but that ended being due to me putting the nested table inside another section so that I could hide it. I want to be able to hide the entire nested table using a rule. Unfortunately it does not give me the formatting rule option to hide it unless I put in inside another section which in turns messes up the code. The old catch-22.

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.