Results 1 to 8 of 8
  1. #1
    iceman.dk is offline Novice
    Windows 10 Access 2013
    Join Date
    Feb 2016
    Location
    Denmark
    Posts
    4

    Question Start field in tabbed form

    I have en form with 6 tabs which each has 8 fields.
    When I click on one of the tabs, the cursor rarely start in the first field (with index 0).
    And it's never the same field that the cursor "decides" to start in.

    Have do I make the cursor jump to the field with index 0 then I click on the tab?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    IF each tab opens a new subform, the index 0 should be the start.
    but you can force it on the TAB_ONCHANGE event

    Code:
    Select Case TabCtl.Value
       case 0
           forms!frmMain!subFrm1.form!txtBox.setfocus
       case 1
           forms!frmMain!subFrm2.form!txtBox3.setfocus
    end select

  3. #3
    iceman.dk is offline Novice
    Windows 10 Access 2013
    Join Date
    Feb 2016
    Location
    Denmark
    Posts
    4
    I don't have subforms, but only added different groups of fields to each tab.

    In the picture, I have just clicked on the tab "Priser" and it opens with the cursor standing in the last field.
    If I click on another tab and back again to "Priser", the cursor either are placed in the first or last field. But there is no logic in which field of the 2.


    Click image for larger version. 

Name:	form_tabbed.png 
Views:	15 
Size:	29.7 KB 
ID:	25157

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Each tab activates a form.
    In each form's Form_Activate event:

    YourFirstTextbox.setfocus

  5. #5
    iceman.dk is offline Novice
    Windows 10 Access 2013
    Join Date
    Feb 2016
    Location
    Denmark
    Posts
    4
    hmmm.... I don't find the Form_Activate event.
    Each tab has following event:
    - Click event
    - dblClick event
    - Mouse Down event
    - Mouse Up event
    - Mouse Move event

    Click image for larger version. 

Name:	form_tabbed_2.png 
Views:	12 
Size:	32.9 KB 
ID:	25169

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Put ranman's code in the OnChange event of the TabCtrl Control.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Quote Originally Posted by davegri View Post
    Each tab activates a form.
    Tabbed Controls don't always involve Subforms...and when they don't there are no Forms 'activated.' The OP, in this case, has simply placed Controls from a single Form on different Pages, either to prevent crowding of the Form or to divide up the Controls in logical groups, or both.

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

    All posts/responses based on Access 2003/2007

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    If there are no subforms, and the tab control is on the main form, then adjusting ranman's code thus should work:

    Code:
    Private sub tabControl1_Change()
        Select Case tabControl1.value
            Case 0
                txtGruppe.setfocus
            Case 1 
                [priser tab first control].setfocus
            .
            .
        End Select
    Use your tabControl name, and adjust the other object names to fit.

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

Similar Threads

  1. tabbed form
    By scottdg in forum Forms
    Replies: 4
    Last Post: 06-17-2015, 10:30 AM
  2. Replies: 4
    Last Post: 04-08-2014, 09:36 AM
  3. Replies: 6
    Last Post: 03-19-2013, 10:28 AM
  4. Tabbed form
    By leftylee in forum Forms
    Replies: 6
    Last Post: 03-14-2011, 12:45 AM
  5. can a tabbed form be too big? Help!
    By ma t in forum Forms
    Replies: 3
    Last Post: 03-10-2011, 10:03 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