473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,385 developers and data experts.

Accessing Tabs on a Tab Control

ADezii
8,834 Expert 8TB
One frequently asked question at TheScripts is how to set focus/make active a specific Tab on a Tab Control other than clicking on it. Before I provide the answer, I feel as though a little summary information would be most helpful.

__1. An individual Tab on a Tab Control is actually a Page Object. For this discussion, we will use the terms Tab/Page interchangeably, however.
__2. Each Page Object is a member of the Pages Collection which includes all Pages on a Tab Control.
__3. Each Page Object provides a Controls Collection which references all Controls on a specific Tab/Page.
__4. Now that you are thoroughly confused, there are basically 5 Methods for referring to an individual Tab on a Tab Control. We will be using the SetFocus Method to demonstrate this point.

ASSUMPTIONS:
__1. Tab Control name: TabCtl1
__2. Number of Tabs/Pages: 6
__3. Tab/Page Captions: Page1, Page2, Page3, Page4, Page5, Page6
__4. Tab/Page Names: pgeOne, pgeTwo, pgeThree, pgeFour, pgeFive, pgeSix

Expand|Select|Wrap|Line Numbers
  1. Method 1:
  2. Me!TabCtl1.Pages(0).SetFocus - set Focus to the 1st Tab
  3.  
  4. Method 2:
  5. Me!TabCtl1.Pages!pgeThree.Setfocus - set Focus to 3rd Tab
  6.  
  7. Method 3:
  8. Me!TabCtl1.Pages("pgeFour").Setfocus - set Focus to 4th Tab
  9.  
  10. Method 4:
  11. Me!TabCtl1.Value = 4 - makes the 5th Tab active
  12.  
  13. Method 5:
  14. SendKeys "%a" - makes the 6th Tab active (a is a 'Hot Key' in the Caption of this Tab. 
NOTE: Should Tabs be added or deleted, your code may have to be modified in order to set Focus to the proper Tab
Mar 11 '07 #1
4 44003
MrDeej
157 100+
Thank you :)
I bookmarked this thread
Aug 20 '07 #2
Fantastic Stuff ...
I've been lokking for this info for ages.

One other question tho ...

How do I reference the controls on the individual pages.
eg
Within VBA ... How do I access access "Control-A" on "Page-3" If I have focus set to "Page-1" ?

Thanks In Advance ...
Mar 17 '08 #3
NeoPa
32,556 Expert Mod 16PB
Smith, this question needs to be asked in the technical forum. This section is for Articles only.

Administrator.
Aug 5 '08 #4
PianoMan64
374 Expert 256MB
Fantastic Stuff ...
I've been lokking for this info for ages.

One other question tho ...

How do I reference the controls on the individual pages.
eg
Within VBA ... How do I access access "Control-A" on "Page-3" If I have focus set to "Page-1" ?

Thanks In Advance ...
They are all at the form level.

Expand|Select|Wrap|Line Numbers
  1.  
  2. me.controlname
  3.  
  4.  
since you have to have a unique name for each control on the form, that is how you reference each control on the form. It doesn't matter that it is in tab control.

Hope that helps,

Joe P.
Aug 5 '08 #5

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

Similar topics

1
by: DU | last post by:
Assuming you have a typical form built in this manner: <form action="..."> <p><input id="idInputText" name="nameInputText" type="text" size="20"></p> <p><input id="idCheckbox"...
2
by: eagle | last post by:
How do I access a control, like a placeholder, from another page, or another user control that may be on the same page. For instance, I have a web page with 2 user controls. One user controls...
1
by: tmaster | last post by:
Within a class, can I create a property that is a listview? Here's what I tried, but it doesn't seem to work: '------------ create property to give the second form access to the first form's...
0
by: Geraldine Hobley | last post by:
Hello I have a problem whereby I have a treeview control on one form called projecttree and I wish to clea the nodes from this control in another form The form that contains the treeview is...
10
by: Jack Russell | last post by:
If I know the name of a control can I access it (change its text etc) without looking through all the controls for one with this name? Thanks Jack Russell
1
by: Jeff Lynch | last post by:
I'd like to add the following attributes to the Login control's Login Button to create a CSS rollover effect. How can I access the control's login button from the page's code-behind? ...
5
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc"...
3
ADezii
by: ADezii | last post by:
One frequently asked question at TheScripts is how to set focus/make active a specific Tab on a Tab Control other than clicking on it. Before I provide the answer, I feel as though a little summary...
2
by: Mahesh83 | last post by:
Hi In Tabs Control by default it show focus on the First Tab but I want to make Default tab to load is third tab to show Focus on the Form Load Please help me... Cheers
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.