473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I test for which tab is active in VBA?

Seth Schrock
2,965 Expert 2GB
I have a Select All check box on one of my databases. It currently runs an update query that selects or unselects all of the records in a subform. I now have two subforms on separate tabs in a tab control. I would like to be able to have the Select All checkbox know which tab is visible and do the selecting/unselecting on just that form. I initially thought I would test for which tab had the focus, but I immediately realized that once I click on the Select All checkbox, no tab has focus. Is there a way to test which tab is active/visible?
Nov 15 '12 #1

✓ answered by Rabbit

Me.tabControlName returns the index of the tab that is active.

7 16407
Rabbit
12,516 Expert Mod 8TB
Me.tabControlName returns the index of the tab that is active.
Nov 15 '12 #2
Seth Schrock
2,965 Expert 2GB
So I could do something like:

Expand|Select|Wrap|Line Numbers
  1. If Me.tabControlName = "Devices_tab" Then 'the name of one of my tabs
  2.     'Do something
  3. Else
  4.     'Do something else
  5. End If
Nov 15 '12 #3
Rabbit
12,516 Expert Mod 8TB
Almost but not quite, it's the tab number starting at 0. If you want the name, you will have to use the tab number to get it from the pages collection and then get the name from that.
Nov 15 '12 #4
NeoPa
32,556 Expert Mod 16PB
Rabbit:
Me.tabControlName returns the index of the tab that is active.
Surely that returns a Page object Rabbit? I can't see how this can work. Am I missing something?
Nov 15 '12 #5
Rabbit
12,516 Expert Mod 8TB
I'll admit the behavior is a bit odd. But if you MsgBox the control or Debug.Print it, it shows you a number, the number of the tab that is on top.
Nov 15 '12 #6
Seth Schrock
2,965 Expert 2GB
It works. I never would have guessed that, but I can't argue with the results. Thanks rabbit.
Nov 15 '12 #7
NeoPa
32,556 Expert Mod 16PB
Sorry. My bad. It's the TabControl you're printing rather than the Page itself. The TabControl has a default property called .Value which reflects which of its Pages is currently selected. Much like a Frame returns a value representing which of the Options within it is currently selected.
Nov 16 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: StepH | last post by:
Hi, I've this module : from optparse import OptionParser import re _version = "P1" def writeVar(f, line):
9
by: Weekend | last post by:
Currently, i want to develope a multiple choice exam website. The content of the test is store in an XML file. I want to carry out some function. Could you tell me which programming language should...
22
by: Alex Martelli | last post by:
I have fixed almost all of the outstanding bugreports and feature request for gmpy: divm doesn't leak memory any more, truediv and floordiv are implemented for all types, etc -- in the current CVS...
6
by: trentdk | last post by:
I want to test which language (testing C and FORTRAN) would be faster with math calculations; one test with intergers, and another test with floats. What math formulas/functions would you guys use...
4
by: CodeRazor | last post by:
I need to retrieve a list of groups from Active Directory. Then i need to retrieve a list of users from a group. I'm unfamiliar with Active Directory objects. Can i connect to Active Directory...
6
by: ypjofficial | last post by:
HI, I have following terrific confusion. class test { public: int i; int * j; int **k;
20
by: Parag | last post by:
Hi, I am trying to figure out best testing tool for my project. I have narrowed down my requirements to two tools NUNIT and VSTS unit. But I have used neither and I have to use only one of them....
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
48
by: Ark Khasin | last post by:
Unit testing is an integral component of both "formal" and "agile" models of development. Alas, it involves a significant amount of tedious labor. There are test automation tools out there but...
6
by: Vyacheslav Maslov | last post by:
Hi all! I have many many many python unit test, which are used for testing some remote web service. The most important issue here is logging of test execution process and result. I strongly...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.