Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Control Click Event is dead

Status
Not open for further replies.

bradmaunsell

Programmer
May 8, 2001
156
0
0
US
Access Pro 2003 on XP SP 2

I have a form with a tab control having 5 tabs.

I can't get the tab page click event to be recognized.

This simple code doe absolutely nothing.


Private Sub pagBinding_Click()
MsgBox "Single click"
End Sub


Any ideas?

Thanks,
Brad
South Burlington, VT
 
Out of curiosity, I tested this, and the event is triggered when you click on the "body" of the tab and not on the "tab" portion!

I couldn't find an "OnChange" event for a tab control.

Karl
 
Private Sub pagBinding_Change()
MsgBox "Page changed"
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes, it does fire when you click the BODY of the tab control. However, the properties sheet for the PAGE offers a click event that appears to be be dead. I did not find any reference to this issue in the FAQ sections.
 
OK, I can get it (On click event) to work when you click to the right of the tabs and above the body.

I guess you can tell I am trying to learn this too.

Karl
 
Actually, the reason for wanting this (page click event fire) is to cause an update of the information on the page.

The info to be updated is not bound to a table and I use a couple of functions to figure out the results. I can do this with a button on the page but want to have the data automatically updated when ever I go to this page.

Brad
 
I'm confused at to your problem. I just created a form and added a tab control on the form (named TabCtl0). I selected the tab control and selected [Event Procedure] via the On Change property of the tab control. In the OnChange event, I added the following code. The only time this code is executed is then the tab is selected.

Private Sub TabCtl0_Change()

MsgBox TabCtl0.Value

End Sub
 
It (on change) is executed when a DIFFERENT tab is selected.

Karl
 
Just in case I have made my issue clear...

Tab Control TabCtl0 has six tabs.
pagAddress
pagRateApplication
pagEndorsements
pagGridAndWordQuotes
pagBindingAndInvoice
pagWordDocs

Each page offers events for click, double-click, mouse down, mouse move and mouse up. That's it for for events available.

I want to fire the click event when I click on the tab for pagBindingAndInvoice. Note that I want to click actual tab for pagBindingAndInvoice - not the whole thing - TabCtl0.

I have the latest updates for both windows and office 2003 installed. When I click the tab, nothing happens. As you can see by my test code above, the code does not get to my test sub routine.

Brad
 
Again, play with the TabCtl0_Change event procedure, playing with the Value property and the Pages collection of the TabControl object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I must have been asleep!

Your previous suggestion of playing with the TabCtl0_Change event procedure looks like it is just what I need.

By testing for the desired page number, I can trigger the running of my functions and populate my form boxes.

Thanks very much.

Brad
 
I normally capture the active page using an explicit reference in the change event:
Code:
Private Sub tabMain_Change()
On Error GoTo ErrHandler
  
  [green]'get a reference to the active page[/green]
  Dim pg As Page
  Set pg = tabMain.Pages(tabMain.Value)
  
  [green]'update the form's caption[/green]
  Me.Caption = "Customer Orders - " & pg.Caption
  
  [green]'take action for specific pages[/green]
  With pg
    Select Case .Name
      Case "Page1"
        [green]'do stuff[/green]
      Case "Page2"
        [green]'do stuff[/green]
      Case "Page3"
        [green]'do stuff[/green]
      Case "Page4"
        [green]'do stuff[/green]
    End Select
  End With
  
ExitHere:
  On Error Resume Next
  Set pg = Nothing
  Exit Sub
ErrHandler:
  Debug.Print Err, Err.Description
  Resume ExitHere
End Sub

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top