Solved On entry of two digits (no more, no less) in intField1, immediately set focus to txtField2 ?

alan2013

Registered User.
Local time
Today, 06:11
Joined
Mar 24, 2013
Messages
92
On a continuous Form, I'd like - if possible - to be able enter two digits in intField1 and - without having to hit the Tab key, or click on txtField2, etc - to have the focus set to txtField2. Is that achievable.......in VBA or otherwise (maybe via a Validation Rule) ? I've been trying the code below with After_Update, Before_Update, On_Dirty... but can't get anything to work. Can it be done ?

If Len(Me.intField1.Value) = 2 Then
Me.txtField2.SetFocus
End If
 
If you are using an input mask, you could set AutoTab to True.
 
If that is a text box for input, you can look at the "OnChange" event as a way to note that two non-blank characters have been entered, because the OnChange event triggers for each keystroke. You can check the control.Text property each time a key is entered to see what is in the box. Then you can decide what to do after each keystroke, including a .SetFocus to something else. The down side of this is that your user could backspace to remove the first character, but the second character would not be correctable so easily.
 
Thanks for your response, Josef. There's no input mask, as intField1 is Number data type. One can't set an input mask on a field of Number data type, right ?
 
e.g: textbox with input mask 00;0;_

/edit: see attachment
 

Attachments

Last edited:
Thanks ever so much, Pat. That worked really well with my numeric field. Josef and The_Doc_Man : thanks to you too; your suggestions have resolved some other elements I'm working on.
 

Users who are viewing this thread

Back
Top Bottom