Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tab control pages (Access03)

    What is the proper way to use the page click event on a tab control? I have a form that on opening two buttons are hidden. I only want the buttons displayed when someone has clicked on the Attendance tab. I used the following code.

    Private Sub Attendance_Click()
    Me.cmdReports.Visible = True
    Me.cmdCerts.Visible = True
    End Sub

    I put the same code in the after update event of a control on that tab and it worked properly. I think it is better if the code is on the page click event because then I could use the false version when other tabs are selected. I want to restrict the viewing the buttons to when the person is on a specific tab so that they have made the proper preselections. I have the buttons where they can be seen when on other tabs, in the form footer, because of space issues.

    Thank you! Fay

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Tab control pages (Access03)

    The On Click event of the individual tab pages is pretty useless. You must use the On Change event of the tab control as a whole. The active tab is represented by the Value of the tab control, starting to count at 0 (so Value = 2 means that the 3rd tab is active etc.). Say that Attendance is the 3rd tab, and that the tab control is named tabPages.

    Private Sub tabPages_Change()
    Me.cmdReports.Visible = (Me.tabPages.Value = 2)
    Me.cmdCerts.Visible = (Me.tabPages.Value = 2)
    End Sub

    You can also use a Select Case statement if you want to execute more code depending on the tab page that is activated.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab control pages (Access03)

    Thanks Hans. I kind of figured there was limited true in advertising in this situation. Thanks I will take your comments and work it up from here. Fay

  4. #4
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab control pages (Access03)

    Got it working exactly as needed and advertised this time. Thanks. Life is so much fun when the little things work like they are suppose to. Fay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •