Results 1 to 2 of 2
  1. #1
    swavemeisterg is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    28

    Take action based on open tab

    Is it possible to use the focus of a tab group as a criteria for an If statement?

    For example, I have three tabs, and I want to run three portions of code depending on which tab is open. I know that I could use buttons to do this, but I'd rather just use the built in tabs. Any one know if this is possible?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You need to use the Tabbed Control's OnChange event; here's a quick tutorial on the subject:

    *********************

    The first thing to understand is that Tabbed Pages are indexed starting with zero, i.e. the first page has a value of 0, second page has a value of 1, third page has a value of 2, etc.

    Secondly, you need to understand that the OnClick event of a Tabbed Page only fires when you click on the page itself, not the tab at the top of the page!

    Lastly, you need to understand that the Tabbed Control change event fires anytime the Tabbed Pages change. But to base something on the change event, you have to identify the particular page that has focus.

    Code:
    Private Sub YourTabbedControl_Change()
      Select Case YourTabbedControl 
    	Case 0  'First Page 
    	  'Code for Page 1 goes here
    	Case 1  'Second page 
    	  'Code for Page 2 goes here
        Case 2   'Third page
     	  'Code for Page 3 goes here
      End Select
    End Sub

    *********************


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 07-18-2012, 07:53 AM
  2. Open form based on subform - possible
    By Richie27 in forum Access
    Replies: 2
    Last Post: 06-19-2012, 12:52 PM
  3. Open report based on a value
    By boxsta in forum Reports
    Replies: 12
    Last Post: 06-11-2012, 09:26 AM
  4. open form based on comboboxes
    By bigmac in forum Forms
    Replies: 1
    Last Post: 04-04-2012, 06:55 AM
  5. Open a table in a From based on a filter
    By turbobeagle in forum Forms
    Replies: 1
    Last Post: 01-11-2008, 12:27 PM

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
  •  
Other Forums: Microsoft Office Forums