Solved

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

Posted on 2014-01-14
3
356 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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