Results 1 to 7 of 7
  1. #1
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182

    Two Questions about Subforms and Tab Controls/Pages

    I have a Tab Control with 3 tabs that display three different subforms. When I switch between tabs, I want to SetFocus to a specific field in the active subform page. How do I do this? Additionally, is there a way to set a shortcut key (Ex: Crtl + 1) to navigate to a particular tab?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    me.Subform1.form.txtBox.setfocus

    use the BUILDER, it always gets the path correct.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Set TabOrder property and when form first opens, control with 0 will get focus

    Do you really want to force user to be in a particular control when they return to a page? What if they would rather be in the same control they moved to?

    This is surprisingly harder than would think. The Tab control pages have events, such as Click, but they don't seem to trigger.

    A & in a caption property will cause following character to act as Alt+character shortcut. However, does not work so well on Tab control. Once inside a subform, the main form shortcuts will not work.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182
    Quote Originally Posted by ranman256 View Post
    me.Subform1.form.txtBox.setfocus

    use the BUILDER, it always gets the path correct.
    What EventProperty should this go under?

  5. #5
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182
    Quote Originally Posted by June7 View Post
    Set TabOrder property and when form first opens, control with 0 will get focus

    Do you really want to force user to be in a particular control when they return to a page? What if they would rather be in the same control they were already in?

    A & in a caption property will cause following character to act as Alt+character shortcut. However, does not work so well on Tab control. Once inside a subform, the main form shortcuts will not work.

    I am not concerned with TabOrder. I just want to be able to view whatever tab I am interested in by pressing a shortcut-key

    And I am positive I want to force the user to be in a particular control.

    And I know how that & in the caption allows for an Alt+Character shortcut. But I was hoping for a VBA alternative, so that I can create a new record AND force setfocus.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Could use the Tab control Click event. The Tab control Value is the index of the page that is clicked. However, must click on the tab button, not just anywhere on the page.

    Select Case Me.Tab1
    Case 0


    Or maybe use the subform container Enter event.

    By TabOrder, I meant the property of controls, not the order of tabs. This determines order controls get focus when tabbing or entering.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182
    Quote Originally Posted by June7 View Post
    Could use the Tab control Click event. The Tab control Value is the index of the page that is clicked. However, must click on the tab button, not just anywhere on the page.

    Select Case Me.Tab1
    Case 0


    Or maybe use the subform container Enter event.

    By TabOrder, I meant the property of controls, not the order of tabs. This determines order controls get focus when tabbing or entering.
    Thank you June7. The TabOrder thing worked.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-11-2012, 11:16 AM
  2. subforms on tabbed pages
    By jedder in forum Forms
    Replies: 2
    Last Post: 03-16-2012, 12:16 PM
  3. Controls in forms and subforms
    By donnan33 in forum Access
    Replies: 2
    Last Post: 01-05-2012, 10:29 AM
  4. Replies: 5
    Last Post: 06-29-2010, 06:10 AM
  5. Controls don't work on subforms
    By rscott7706 in forum Forms
    Replies: 8
    Last Post: 03-07-2010, 10:17 PM

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