Load subform only when tab selected

  • Thread starter Thread starter S. Jackson
  • Start date Start date
S

S. Jackson

After too much reading, I found a tip on how to improve the performance of a
form when loading:

"Watch out for Tab controls with many pages and subforms on each page.
Loading all those subforms will slow the opening of your form. One
alternative is to load the subforms on a Tab control page only when that
page is selected. You can do this by using the Change event of the Tab
control to check the Value of the control. This tells you the PageIndex of
the selected page. You can set the SourceControl property of your subforms
only when the page they appear on is selected; you can't set it in design
view. "

I got this at:
http://msdn.microsoft.com/library/d.../en-us/dnacbk02/html/ODC_CookbookChapter8.asp

I want to do this, but I don't how. My form contains 8 subforms so I think
this could really help with performance. I am using Access 2000 and I do
not see a Change event on the tab control. I am lost (again).

S. Jackson
 
There is a Change event for the Tab Control. Make sure you have selected
the control, not one of the tabs.
 
I'm not sure which control you're wondering about.
You already have a tab control on your form, and it looks as if you have
found its Change event.

You'll need to change the code in the article to use the names of your
objects;
wherever the code says TabStuff, put the name of your tab control.
You'll also need to put in your names for pg1, sfrm1, frmStuff_1,
StuffID, and all the corresponding ones for other tabs.

HTH
- Turtle
 
Thanks! At first, I couldn't figure out how to click the Tab Control - its
tricky! After that I had gotten everything changed in the code but for the
page control names - read your post, changed those and it worked. Thanks!

S. Jackson
 
Back
Top