?
Solved

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

Posted on 2014-01-14
3
Medium Priority
?
362 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
[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
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

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