Results 1 to 9 of 9

Thread: [RESOLVED] Tab Control Form Set Focus--Now won't hide any pages (tabs)

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    34

    Resolved [RESOLVED] Tab Control Form Set Focus--Now won't hide any pages (tabs)

    I was getting an error when trying to hide a page on a tabbed form in access that you can't hide a control that has the focus. So I used a line of code Me.tabIwasnotusing.SetFocus and now it doesn't give me an error but it also isn't hiding any of the tabs as indicated below that line Here is the code for the form. I was having trouble with hiding "pgEvaluations"

    [/CODE]
    Option Compare Database
    Option Explicit
    Public frmType As String

    Private Sub Form_Current()
    frmType = Nz(Me.docChangeCategory, "General")
    setProperties
    End Sub

    Private Sub Form_Load()
    frmType = Nz(Me.OpenArgs, "")
    If frmType = "" Then frmType = "General"
    Call setProperties
    End Sub

    Public Sub setProperties()
    showAllPages
    Select Case frmType
    Case "General"
    With Me
    .lblCaption.Caption = "Document Information"
    End With
    Case "Create"
    With Me
    .lblCaption.Caption = "Create SOP"
    hidePage ("pgAnnualReview")
    hidePage ("pgRetire")
    End With
    Case "PenAndInk"
    With Me
    .lblCaption.Caption = "Pen And Ink SOP"
    Me.pgFinalized.SetFocus
    hidePage ("pgEquipment")
    hidePage ("pgEvaluations")
    hidePage ("pgAnnualReview")
    hidePage ("pgRetire")
    End With
    Case "Revise"
    With Me
    .lblCaption.Caption = "Revise SOP"
    hidePage ("pgEquipment")
    hidePage ("pgAnnualReview")
    hidePage ("pgRetire")
    End With
    Case "Supplement"
    With Me
    .lblCaption.Caption = "Supplement SOP"
    hidePage ("pgEquipment")
    hidePage ("pgAnnualReview")
    hidePage ("pgRetire")
    End With
    Case "Review"
    Me.pgAnnualReview.SetFocus
    With Me
    .lblCaption.Caption = "Annual SOP Review"
    hidePage ("pgEquipment")
    hidePage ("pgEvaluations")
    hidePage ("pgSignatures")
    hidePage ("pgFinalized")
    hidePage ("pgRetire")
    End With
    Case "Retire"
    Me.pgRetire.SetFocus
    With Me
    .lblCaption.Caption = "RETIRE (Archive) SOP"
    hidePage ("pgEquipment")
    hidePage ("pgEvaluations")
    hidePage ("pgSignatures")
    hidePage ("pgFinalized")
    hidePage ("pgAnnualReview")
    End With
    Case Else
    MsgBox frmType
    End Select
    End Sub

    Public Sub showAllPages()
    Dim pg As Access.Page
    For Each pg In Me.tabControl.Pages
    pg.Visible = True
    Next pg
    End Sub

    Public Sub hidePage(pgName As String)
    Me.tabControl.Pages(pgName).Visible = False
    End Sub

    [CODE]

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    Not the right way to do it but not the wrong way either...

    Check this for me... Does it work?

    Code:
    Public Sub hidePage(pgName As String)
        Dim pg As Access.Page
        For Each pg In Me.tabControl.Pages
            If pg.Name = Trim(pgName) Then
                pg.Visible = False
                Exit Sub
            End If
        Next pg
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    34

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    That did not work either. The code I created is hiding the cases Perfectly that do not involve Hide Page pgEvaluations. I was getting an error when I tried to hide it that you can not hide a page that contains the control that has the focus. Then when I set the focus from pgEvaluations to another page for a case that needs to hide pgEvaluations (pen and ink) it shows all of the pages and does not hide any of the tabs.

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    Can I see your file?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    34

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    This is my latest version 17. I uploaded it on 4shared.com at the following link:

    http://www.4shared.com/file/C1BShL5n...P_DCS_V17.html

    Thank you!

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    Whoa! There are so many tables and forms... Which is the form you are referring to?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    34

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    the form with the tabs is frmMasterTabForm. Some of the code is also in the class module mdlDocUtilities. This little project has turned into a MONSTER!! But it should be pretty cool when it is done! If it ever works

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Tab Control Form Set Focus--Now won't hide any pages (tabs)

    Change

    Case "PenAndInk"
    to

    Code:
    Case "Pen And Ink"
    and try again in Public Sub setProperties()
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  9. #9

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    34

    Re: [RESOLVED] Tab Control Form Set Focus--Now won't hide any pages (tabs)

    The devil is in the details!!! Sorry I took so long to Thank you, I have jumped into another set of tweaks I need to make. If you want you can check out my most recent post! I changed the pages Evaluations and Signatures on the tab control of frmMasterTabForm and can't get them to filter!

    "Filter continuous subform from combo box selection MS Access 2007, Office 2007" new link: http://www.4shared.com/file/p7YqKyff...P_DCS_V26.html

    (If you get a minute)

    Again Thank you so much! I spent a lot of hours scratching my head over two spaces, I didn't know if I was happy or upset!!!

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width