Solved

VB - TabControl - SubForm - do some code ONLY If it is the Active tab subform

Posted on 2014-01-14
3
357 Views
Last Modified: 2014-01-14
Hello again.

I have a Form with a TabControl.  On that TabControl I have 7 or 8 pages and each page will have 1 to 4 Main subforms (not of each other - just of that Page of the TabControl.

I have some code that I only want to execute IF and only if a particular page and it's sub form are the ACTIVE tab that the user is viewing.

I have tried "If xxxx.visible=true then" but even though at the time I execute the doubleclick the form isn't visible because I have the Page set to visible = no at should have run it sees that the subform is "visible" so it does the 'then' and not the 'else' steps.

Any suggestion of another control trigger I can use... (also tried using a txtwait textbox's Got Focus and it didn't do the trick for me.)
0
Comment
Question by:wlwebb
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39781105
use the Change event of the Tab Control

private sub TabCtl0_change()

select case me.tabCtl0.value
        case 0   'the first tab/page
             'your code here
        case 1
             'your code here

       case 8
             'your code here
     
end select


end sub
0
 

Author Comment

by:wlwebb
ID: 39781137
Are the "Case" 's the Page Numbers of each Tab???  I know they actually start at 0 that's why I'm wondering if
Case 0 means something like in english

"in case 0 changed then do this code"
"in Case 1 changed then do that code"

meaning where "Page 0 (tab) changed" or
where "Page 1 (tab) changed" etc...

Am I understanding that right?
0
 

Author Closing Comment

by:wlwebb
ID: 39781145
Cool!....

Just tested the theory with Msgboxes.........  "I see said the blind man"

Thank you for the quick response
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
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 …

713 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