Solved

Set the subforms ControlSource in the tab controls change event.

Posted on 2014-03-31
7
316 Views
Last Modified: 2014-04-01
I  have a main form with a tab control that contains 5 subforms.   This form takes a long time to load due to all the data contained in each of the subforms.  I've done some research on here and it seems a good solution might be to only load the first default tab, and then load the remaining tabs when each is clicked.  However, I'm not sure how to do this.

Any help will be much appreciated. Thanks!
0
Comment
Question by:Jinghui Li
  • 4
  • 3
7 Comments
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39967399
Remove the SourceObject name from the hidden subforms.  When a tab gets focus, set the SourceObject for that subform.
0
 

Author Comment

by:Jinghui Li
ID: 39967423
Ok thanks.  It's been a while since I've done any VBA programming, so please bear with me.  Will I do this with case statements inside the On Change event of the tab control?
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39967474
Yes.  I don't have any examples handy and I don't do this frequently enough to remember the property but it is a property of the tab control.

Select Case Me.yourtab.someproperty
    Case "Pg1"
        Me.sfrmPg1.ObjectSource = "somename"
    Case "Pg2"
        Me.sfrmPg2.ObjectSource = "somename2"
....
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:Jinghui Li
ID: 39967481
Thanks for getting me started.  I'll let you know.
0
 

Author Comment

by:Jinghui Li
ID: 39967572
Me.sfrmPg1.ObjectSource

I don't understand what "sfrmPg1" is referencing.  I have a main form with one tab control that contains 5 pages.  Each of the 5 pages contains a subform.
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39967659
Each subform control has a Name property.  Usually it is the same as the ObjectSource name but it doesn't have to be.  "sfrmPg1" is the Name property of the control whose ObjectSource you want to set.
0
 

Author Comment

by:Jinghui Li
ID: 39970661
That is what I thought.  Thanks for the clarification
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now