Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    300

    Question Unanswered: TAB Control Help

    I have a form which contains a Tab control with 8 tabs, each tab contains a form and there are some with subforms.

    Everything works well but when a user is doing data entry and is using the TAB key on the keyboard, when they TAB to the last field on the Tab, it moves to a new record on that tab, not back to the first field on the current index tab.

    Or if there is a way to get the Tab key to move the user to the next page in the tab control, I could do that too.

    I'd like to see it done either way! --- HELP

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Create the lostfocus event for the last control that needs to receive focus. In that event, set the focus either for the top control or the next page.

  3. #3
    Join Date
    Nov 2003
    Posts
    300
    Could you give me more info on how to do that?

    Would that be something like a GoTo first_Box or Tab #2???

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Click on the last textbox on your 1st tab - go to the properties and click on events. This will bring up a vbscript editor. Under the right drop down box select lostfocus ... in this event you can either add:

    text1.setfocus or
    tab2.setfocus

  5. #5
    Join Date
    Aug 2003
    Posts
    106
    Much more effective than this, you can set an event for the Key_Down event of the Tab Control:

    If KeyCode = vbKeyTab Then
    Forms!YourForm!YourTabControl!PageIndex = Forms!YourForm!YourTabControl!PageIndex + 1
    End If

    This will move to the next page when the user presses the tab key

  6. #6
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Some simple thoughts...

    You could prevent the user from tabbing to a new record by going to the properties of the form, find the 'Cycle' property and change it from 'all records' to 'Current Record.'

    If you use the Key_Down event as sugarflux suggests, then the user can no longer tab between controls on the current page.

    Microsoft responds to the 'Ctrl' 'Tab' keystroke combination by going to the next page on a tab control. For example, go to your desktop, bring up the properties box (a multi-tabbed dialogue box), and use the 'ctrl' tab' to navigate through the tabs. Or in access go to the menu item, Tools, Options. Then flip through the tabs with the same key combination. This will work with your access form also. Tell the users about the key combination (including 'shift' will go backwards).

    After writing special OnExit code to jump to the first control on the next tab, I decided that it was best to let the users navigate to the next tab themselves. This resolved the user's frustration when leaving the last control but wanting to stay on the current tab.
    Last edited by jpshay; 12-05-03 at 10:50.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

Posting Permissions

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