none
IS IT POSSIBLE TO CHANGE RECORDSETS/OPENARGS IN DIFFERENT PAGES WITHIN A TAB CONTROL? RRS feed

  • Question

  • I have a form with a two page Tab Control. I need to run a loop to view some data from my queries in 75 unbound subforms (per tab). The problem is that if I loop all 150 subforms then I get a memory exceed error - I'm hoping to be able to unbind the recordset/openargs and re-open it in a different loop based on tabs. Any thoughts?
    Tuesday, September 26, 2017 2:56 PM

Answers

  • Hi,

    You need to run the loop only at the time when you need it. For example, running a loop for the second tab in the Load event of the form can be deferred because the second tab is not visible yet. So, running the loop on the tab control's change event probably makes more sense in your case. Also, it will run the loop for only 75 subforms rather than 150.

    Just my 2 cents...

    • Marked as answer by InnVis Tuesday, September 26, 2017 7:56 PM
    Tuesday, September 26, 2017 4:09 PM

All replies

  • Hi,

    This question sounds familiar... You should be able to identify which tab you're dealing with and use a separate loop for each page. Some ways to find out the tab or page could include:

    Me.TabControlName

    Me.SubformContainerName.Parent.TabControlName

    Me.TabControlName.Pages(Me.TabControlName).Name = "NameOfTabPage"

    etc.

    (untested)

    Hope it helps...

    Tuesday, September 26, 2017 3:07 PM
  • How should I structure the loop? Should I place it in the on load of the unbound form like I have now or should I place it on change in the Tab Control? If I make it all in the onload, how will I prevent the memory exceed, since it will still fill 150 unbound subforms.
    Tuesday, September 26, 2017 3:56 PM
  • Hi,

    You need to run the loop only at the time when you need it. For example, running a loop for the second tab in the Load event of the form can be deferred because the second tab is not visible yet. So, running the loop on the tab control's change event probably makes more sense in your case. Also, it will run the loop for only 75 subforms rather than 150.

    Just my 2 cents...

    • Marked as answer by InnVis Tuesday, September 26, 2017 7:56 PM
    Tuesday, September 26, 2017 4:09 PM