Solved

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

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

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Cool!....

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

Thank you for the quick response
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now