Tab Control macro not triggering

Bertman123 21 Reputation points
2022-12-21T13:56:40.343+00:00

I have a Tab control on a form in Access. A Private sub for the On Click event for the page works for the first page (Page Index 0). But the the Private sub for the On Click for other Pages on the tab control is not recognized in code. Any Ideas?

Private Sub Page1_Click()
'This works (Page Index 0)
MsgBox ("Hi!")
End Sub

Private Sub Page2_Click()
'This doesn't (Page Index 1)
MsgBox ("Hi!")
End Sub

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
899 questions
0 comments No comments
{count} votes

Accepted answer
  1. Karl Donaubauer 2,056 Reputation points MVP
    2022-12-21T17:10:55.307+00:00

    Hi,

    You must click on the "body" of a tab page to trigger its click event. If instead you want to react to the click on the tabs, you can use the Change event of the tab control like this

    Select Case MyWonderfulTabControlName
    Case 0
    MsgBox ("Hi first tab/page!")
    Case 1
    MsgBox ("Hi second tab/page!")
    Case 2
    'etc.
    End Select

    Servus
    Karl
    Access Bug Trackers
    Access News
    Access DevCon

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.