Results 1 to 11 of 11
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I have a continous form with several fields that the operator must fill.

    What code can I use to advance the focus to the next field automatically when a field completely filled without pressing enter or tab keys?

    Thanks, John

  2. #2
    Star Lounger
    Join Date
    Jan 2003
    Location
    Grass Valley, California, USA
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is F

    There may be a better way, but I would establish a "KeyPress" event on each field being checked for "completely filled" status. In the event code, you can accumulate the keystrokes in the field value, and when you decide that the field is filled (you didn't specify a "filled" criteria), then programmatically shift the focus to the next field of interest (Me.fieldname.setfocus).

    -- Jim

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    Bloomsburg, Pennsylvania
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    In the properties for the controls on the form you can set the "auto tab" to "yes". Select all the controls you want it for at once, then you only have to set it once.

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    Hi Frances

    That was easy, however auto tab is not available for combo boxes.

    I have two combo box one with a 1 character entry and the second with a 3 character entry, each have AfterUpdate event that have to fire when the field is filled.

    I tried several differents events without success.

    Can't seem to get Len(FirstCombo) = 1 (this won't return lenth)

    Any other suggestions?

    Thanks,

    John

  5. #5
    Lounger
    Join Date
    Apr 2002
    Location
    Bloomsburg, Pennsylvania
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    You can only use the auto tab on text boxes. So I guess I would create the combo box as unbound, and create a bound text box right next to it that is part of the tab order. Take the tab stop off of the combo box. Put an input mask and auto tab in the text box. It sounds like they're probably going to know what they want to type in anyway, without using the drop-down from the combo. If they do use the combo, put an event in the after update to set the text box equal to the combo box. You could also add an event to the text box to check for valid data if you want it to limit to the list in the combo box.

    That's what I'd do anyway, but I'm usually finding my own strange ways to do things. I did try it on a small form with 3 fields. With everything autotabing it goes to a new record after the last field. If you want to force them to save you'll have to put a hidden field in to make it loop on the same record. There are probably better ways that I don't know about. Hope this helps.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    While the combo box has the focus, use FirstCombo.Text instead of just FirstCombo.

    FirstCombo.Text is the text that is currently in the text box part of the combo box.
    FirstCombo is the same as FirstCombo.Value; this is the "stored" value.

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    Hi Hans

    Great news!

    What is the event should I test Len(ComboBox.text) = 1 assuming I have an AfterUpdate event associated with to combo as well?

    Thanks, John

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    If you only want to allow a single character, you could use the change event, since it happens with each keystroke.
    Charlotte

  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    Thanks Charlotte & Hans

    Another super learning experience.

    There was typo here, If Len(ComboBox.Text > 0) Then

    John

    PS: Find attached demo from TechNoWini that further explains Events and When
    Attached Files Attached Files

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    (Typo corrected by HansV - thanks to Support4John for pointing it out)

    To monitor what is happening as the user types, use the On Change event, for example

    Private Sub ComboBox_Change()
    If Len(ComboBox.Text) > 0 Then
    SendKeys "{TAB}"
    End If
    End Sub

    The After Update event will be executed if the On Change event boots the user out of the combo box. I would not use SetFocus or something like that in the After Update event to avoid conflicts.

  11. #11
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-

    that demo was great. Thanks

Posting Permissions

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