Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    TabControl Disabling (Access XP SP-2)

    I have a main form with a tabcontrol which has subforms on its pages. The value of a combo box on the main form controls which pages on the tabcontrol are enabled.

    If a certain set of values have been selected in one of the subforms, I would like to disable the tabcontrol page that sub form is on. I can accomplish this by first moving the the focus to another page of the tabcontrol. But I would really like to have the disabled page still be displayed. I can click on the tab for that page and it will be displayed with all the controls grey-out ... just as it should be.

    May question is how do I replicate this clicking in VBA? I have not found anything that seems to work and I know setfocus won't as the page is disabled.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: TabControl Disabling (Access XP SP-2)

    What about disabling the subform on the page, rather than the page itself?
    Regards
    John



  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: TabControl Disabling (Access XP SP-2)

    If there is no other solution, I'll have to do that. Its just more work as the pages often have more than one form along with other controls.

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

    Re: TabControl Disabling (Access XP SP-2)

    You could set focus to a control on the main form outside the tab control, then disable the tab page. Say that txtThis is a text box on the subform, txtThat is a text box on the main form outside the tab control, and pagOther is the tab page.
    <code>
    Private Sub txtThis_AfterUpdate()
    If Me.txtThis = "some value" Then
    Me.Parent.txtThat.SefFocus
    Me.Parent.pagOther.Enabled = False
    End If
    End Sub
    </code>
    The text box txtThat must be visible, otherwise it cannot receive the focus. It could have 0 height and width, however.

  5. #5
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: TabControl Disabling (Access XP SP-2)

    Hans,

    I was close (but no cigar) with my own syntax but I didn't use the Me.Parent form.

Posting Permissions

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