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
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Auto Tab To Next Field When Current Field Is Fille (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)
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
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
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
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.
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.
(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.
(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.
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
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.