Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set the subforms ControlSource in the tab controls change event.

Posted on 2014-03-31
7
Medium Priority
?
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 39

Accepted Solution

by:
PatHartman earned 2000 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 39

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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 39

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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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