By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,525 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

Hide/Unhide Tabs

P: 19
I have a database built on 4 tabs, but inside one of those tabs I would like another group of tabs. The problem is that my second group of tabs are being displayed on ALL of the main 4 tabs and not the single tab that I would like it to. What I am asking is if anyone knows of a code that would only make my second group of tabs visible when only 1 of the 4 main tabs is clicked, and when the other 3 main tabs are clicked, the second group of tabs are NOT visible.

Here is a more visual look at the database.

http://www.geocities.com/database4242/database3.JPG

Thank you
Aug 9 '07 #1
Share this Question
Share on Google+
5 Replies


puppydogbuddy
Expert 100+
P: 1,923
I have a database built on 4 tabs, but inside one of those tabs I would like another group of tabs. The problem is that my second group of tabs are being displayed on ALL of the main 4 tabs and not the single tab that I would like it to. What I am asking is if anyone knows of a code that would only make my second group of tabs visible when only 1 of the 4 main tabs is clicked, and when the other 3 main tabs are clicked, the second group of tabs are NOT visible.

Here is a more visual look at the database.

http://www.geocities.com/database4242/database3.JPG

Thank you
Expand|Select|Wrap|Line Numbers
  1. Try invoking your code on the change event of the tab control on the main form, something like this:
  2.  
  3. Private Sub TabCtl1_Change()
  4. On Error GoTo Error_Routine
  5.  
  6. 'commits any changes
  7. If Me.Dirty Then Me.Dirty = False
  8. Select Case Me.TabCtl1.Value
  9.     Case Is = 0  
  10.         'run code for page1<Me.Page1.PageIndex = 0>
  11.         TabCtl1.Pages.Item(0).Visible = True
  12.     Case Is = 1
  13.        'run code for page2<Me.Page2.PageIndex = 1>
  14.         TabCtl1.Pages.Item(1).Visible = True
  15.         TabCtl1.Pages.Item(1).SetFocus
  16.     Case Is = 2
  17.        'run code for page3<Me.Page3.PageIndex = 2>
  18.         TabCtl1.Pages.Item(2).Visible = False
  19. End Select
  20. Exit_Continue:
  21.         Exit Sub
  22. Error_Routine:
  23.         MsgBox "Error# " & Err.Number & " " & Err.Description
  24.         Resume Exit_Continue
  25.  
  26. End Sub
Aug 9 '07 #2

JKing
Expert 100+
P: 1,206
Give this a try:

Expand|Select|Wrap|Line Numbers
  1. Private Sub tabMain_Change()
  2.     If Me.tabMain.Value = 2 Then
  3.         Me.tabSub.Visible = False
  4.     Else
  5.         Me.tabSub.Visible = True
  6.     End If
  7. End Sub
  8.  
Alternatively have you thought about placing the second tab control in a subform? The subform would be bound to a single page.
Aug 9 '07 #3

JKing
Expert 100+
P: 1,206
Expand|Select|Wrap|Line Numbers
  1. Try invoking your code on the change event of the tab control on the main form, something like this:
  2.  
  3. Private Sub TabCtl1_Change()
  4. On Error GoTo Error_Routine
  5.  
  6. 'commits any changes
  7. If Me.Dirty Then Me.Dirty = False
  8. Select Case Me.TabCtl1.Value
  9.     Case Is = 0  
  10.         'run code for page1<Me.Page1.PageIndex = 0>
  11.         TabCtl1.Pages.Item(0).Visible = True
  12.     Case Is = 1
  13.        'run code for page2<Me.Page2.PageIndex = 1>
  14.         TabCtl1.Pages.Item(1).Visible = True
  15.         TabCtl1.Pages.Item(1).SetFocus
  16.     Case Is = 2
  17.        'run code for page3<Me.Page3.PageIndex = 2>
  18.         TabCtl1.Pages.Item(2).Visible = False
  19. End Select
  20. Exit_Continue:
  21.         Exit Sub
  22. Error_Routine:
  23.         MsgBox "Error# " & Err.Number & " " & Err.Description
  24.         Resume Exit_Continue
  25.  
  26. End Sub
Didn't mean to step on your toes there puppydogbuddy. Must have been mid post while you posted.
Aug 9 '07 #4

puppydogbuddy
Expert 100+
P: 1,923
Didn't mean to step on your toes there puppydogbuddy. Must have been mid post while you posted.
LOL!! Ouch...........
Aug 9 '07 #5

P: 19
Thank you, it works excellent now. Could not ask for it to look any better :)
Aug 10 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.