473,320 Members | 2,006 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,320 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 43963
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
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.