Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2009
    Location
    Ohio, United States
    Posts
    167

    Unanswered: Automatically tab to next form text box at end of field

    I have a form with 2 spaces per record, both of which will be entered with the aid of a barcode scanner. On the source table I formatted the two fields as text and limited the string length to the normal number of characters in each barcode. I was hoping that this would result in the form progressing to the next text box when the previous text box had reached the character limit, however, this was not the case. Is there a setting or code anyone has used to make the focus shift to the next item in the tab order when the last character has been entered in the previous text box? Joshua

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    Private Sub FirstTextBox_Change()
     If Len(Me.FirstTextBox.Text) = n Then SecondTextBox.SetFocus
    End Sub
    Replace the n with the number of characters allowed in the first field, and replace FirstTextBox and SecondTextBox with your actual names.
    Last edited by Missinglinq; 09-04-09 at 18:13.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Clever!
    Have a nice day!

  4. #4
    Join Date
    Jan 2009
    Location
    Ohio, United States
    Posts
    167
    Cool that seemed to work, how would I modify it to go to a new record. Like if I entered a pair of numbers and on the second number, once it reached the required number of characters, it skipped to a new record under the first number. Thanks! Joshua

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    Private Sub SecondTextBox_Change()
    If Len(Me.SecondTextBox.Text) = n Then
      DoCmd.GoToRecord , , acNewRec
      FirstTextBox.SetFocus
    End If
    End Sub
    Again replacing n with the number of characters in the second field.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Good post Missinglinq
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Access lets you do this, of course, using the AutoTab Property, but the control being exited has to have one of those evil Input Masks set! Not worth the trade-off, in my book!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Agreed. Input Masks are one of those "features" I would not bother installing if I had a choice -- a waste of room on the property sheet ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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