473,396 Members | 2,002 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,396 software developers and data experts.

Testing for when a Tab Control Page is selected

I have a form with a tab control on it that has about 5 tabs.When one of the tabs is selected, I want to set the "Visible" property from "No" to "Yes" on a subform that resides on the main form, but outside of the tab control area. Then I want it to disappear again when any of the other tabs are selected.

In design view each tab (or "Page") has a click event associated with it. I thought that by attaching the code to this click event, I would be able to acheive the desired result, but alas; click as I will on the page, it doesn't seem to acknowledge my code (Note: I've tried putting a trivial message box code in there just see if it's getting into the code and nothing.)

Also, is there a property for a TabControl that return which page is active in general? So you could say something like "If Forms! [TabCtrl5].Page = 4 Then ...."

Thanks.
Oct 29 '07 #1
8 15035
Rabbit
12,516 Expert Mod 8TB
Use the Tab Control's Change property. Calling the tab control returns the page number it is on.
Oct 29 '07 #2
I'm not sure what you mean by "calling the tab control" to return the page number. I put the code in the Change Event of the tab control, as you suggested, but I'm still not finding the right syntax to get the page number. Just using the name of the tab control comes up null, and if I use "Me![TabControlName]" I get and error, as well as "Me![TabControlName].Page".

Thanks for your help.
Oct 29 '07 #3
Rabbit
12,516 Expert Mod 8TB
I'm not sure what you mean by "calling the tab control" to return the page number. I put the code in the Change Event of the tab control, as you suggested, but I'm still not finding the right syntax to get the page number. Just using the name of the tab control comes up null, and if I use "Me![TabControlName]" I get and error, as well as "Me![TabControlName].Page".

Thanks for your help.
Are you using Access 2003? In 2003 I use Me.TabControlName and it returns the page number.

What is the error you're getting?
Oct 29 '07 #4
Are you using Access 2003? In 2003 I use Me.TabControlName and it returns the page number.

What is the error you're getting?
I'm using 2003.
I typed this in:
Private Sub TabCtl59_Change()
x=Me.TabCt159
Msgbx x
End Sub

It said:
Compile Error: Method or Data Member not Found
"Me.TabCt159" is highlighted when I go to Debug.
Oct 29 '07 #5
Rabbit
12,516 Expert Mod 8TB
I'm using 2003.
I typed this in:
Private Sub TabCtl59_Change()
x=Me.TabCt159
Msgbx x
End Sub

It said:
Compile Error: Method or Data Member not Found
"Me.TabCt159" is highlighted when I go to Debug.
You have 159, it should be L59.
Oct 29 '07 #6
missinglinq
3,532 Expert 2GB
Replacing

Msgbx x

with

Msgbox x

would probably help, too! But when I use Rabbit's code in ACC2003 it simply returns the tabbed control's name, not the page.

This will identify the page that was just clicked:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTabbedControl_Change()
  2. If Me.YourTabbedControl.Value = 0 Then ‘First Page
  3.   Msgbox "Page 1"
  4. ElseIf Me.YourTabbedControl.Value = 1 Then ‘Second page
  5. Msgbox "Page 2" 
  6. ElseIf Me.YourTabbedControl.Value = 2 Then ‘Third page
  7. Msgbox  "Page 3"
  8. End If
  9. End Sub
Notice that it's zero based. The first page returns zero, second page returns 1, etc.

Linq ;0)>
Oct 29 '07 #7
Thanks. Changing the "1" to an "l" did the trick.
Oct 30 '07 #8
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck.
Oct 30 '07 #9

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

Similar topics

5
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main...
4
by: Iain Porter | last post by:
Hi all, I have a usercontrol (a textbox with dropdown calendar that fills the textbox with the selected date) that I implement in a datagrid in a webform. On first loading the page, the datagrid's...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
1
by: Mad Scientist Jr | last post by:
I'm stuck trying to work with a HTML <SELECT> control and javascript (similar to DualList but that control doesn't offer enough options to totally control the text on the buttons and control, also...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
7
by: AndrewMBaldwin | last post by:
I have a grid control (inherits from Placeholder) that has a few buttons on it. On this grid there is a filter form, which allows the user to filter/search the table for specific information. My...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
18
by: Andrew Wan | last post by:
I have been developing web applications with ASP & Javascript for a long time. I have been using Visual Studio 2003.NET. While VS2003 is okay for intellisense of ASP & Javascript, it's still not...
6
by: Jonathan Wood | last post by:
I have a databound dropdownlist control. Based on some other criteria, I need to specify the selected item in my pages Load event. The problem is that, in my load event, the control does not yet...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.