Solved

Set the subforms ControlSource in the tab controls change event.

Posted on 2014-03-31
7
326 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 36

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 36

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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 36

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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 …

821 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