Tab Control

LB79

Registered User.
Local time
Today, 23:05
Joined
Oct 26, 2007
Messages
505
Hello,

Im having trouble with the Tab Control.
I have a Tab Controlwith several tab. When I select a tab I want a button to appear in the main form depending on which tab was pressed. I have set everything up and written code to do this and assigned the code to trigger when the tab is pressed... but nothing happens. My code is below. Can anyone advise?
Thanks

Private Sub Tab1_Click()
RunBox.Visible = True
End Sub
 
its the on click event of the page of the tab and not the tab itself.
 
Hi - thanks for the reply. Im not sure what you mean though.
When I select the Tab Control it either lets me select the Tab (including the Tab page), or it lets me select Detail (which is for the whole form).
Im using Access 2003 if that helps at all?
 
The first thing to understand is that tabbed pages are indexed starting with zero, i.e. the first page has a value of 0, second page has a value of 1, third page has a value of 2, etc.

Secondly, you need to understand that the OnClick event of a tabbed page only fires when you click on the page itself, not the tab at the top of the page!

Lastly, you need to understand that the tabbed control change event fires anytime the tabbed pages change. But to base something on the change event, you have to identify the particular page that has focus.

Code:
Private Sub YourTabbedControl_Change()

If Me.YourTabbedControl.Value = 0 Then 
'Code if 1st page is clicked

ElseIf Me.YourTabbedControl.Value = 1 Then 
'Code if 2nd page is clicked

ElseIf Me.YourTabbedControl.Value = 2 Then 
'Code if 3rd page is clicked
End If
End Sub

The label will change as you click betweeen pages.
 
Genuis!

Thanks very much!

(No cats were harmed while using this advice).
 
You can also refere to your tabbed pages by name

eg

mytabcontrol.pages("MyTabPageName")
 
THANK YOU, THANK YOU.............. I just posted a question very similar to this and this was the answer I needed.
 

Users who are viewing this thread

Back
Top Bottom