Results 1 to 3 of 3
  1. #1
    LukeJ Innov is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    31

    Button to open certain tab

    Hi All,



    Basically pretty sure it's a simple command but struggling to figure this one out.

    I have a form with a two page tab control on it, on another form I have a button, I would like that button to open the form (easy 'docmd.openform,,"frmname") but also to show a certain page of the tab control.

    Cheers,

    LJ

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  3. #3
    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 can do that using the OpenArgs argument of the DoCmd.OpenForm command, similar to opening the Form to a given Record, except that this time you're simply passing a message to Access, telling it to open the given page:

    In the first Form (replacing FormToBeOpened, of course, with the actual form name)

    Code:
    DoCmd.OpenForm "FormToBeOpened", , , , , , "OpenTabPage"


    Then, in the Form to be opened:

    Code:
    Private Sub Form_Load()
    
    If Len(Nz(Me.OpenArgs, "")) > 0 Then
     
     If Me.OpenArgs = "OpenTabPage" Then
       Me.TabControlName.Value = X
     End If
    
    End If
    
    End Sub


    Replace TabControlName with your actual Tabbed Control name, and the X with the page index number of the page you want opened. The index is Zero-based, so the first page = 0, the second page = 1, etc.

    Linq ;0)>

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

Similar Threads

  1. Command button open url
    By patrickmcdiver in forum Programming
    Replies: 2
    Last Post: 03-06-2012, 11:08 AM
  2. HOW TO: Button to open different forms?
    By Natan in forum Programming
    Replies: 5
    Last Post: 08-01-2011, 01:58 PM
  3. cmd button to open form
    By stephaniehpcswf in forum Access
    Replies: 1
    Last Post: 02-23-2011, 04:46 PM
  4. Button to open a Report
    By 95DSM in forum Reports
    Replies: 1
    Last Post: 07-09-2010, 11:11 AM
  5. Open a second db from a cmd button
    By Rick West in forum Access
    Replies: 3
    Last Post: 05-12-2010, 08:44 AM

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