Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move the cursor to next field after enter a value?

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
I am design a form, trying to make cursor moving automatically after input data in the previous field. My number is only from 1 to 7. Could I make the cursor move after entering a single digit? How can I do it?

Thank you

Haijun


 
Try and put "textbox2".setfocus in the current controls AfterUpdate() event.
eg....Private Sub textbox1_AfterUpdate()
textbox2.SetFocus
End Sub

"textbox1" is the name of the control you enter text/number into.
textbox2 would be where you want to go to.

Hope this helps
 
Code textbox1's KeyUp event. The "On Key Up" event occurs when a key is released.


Private Sub TextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
Me!textbox2.SetFocus
End Sub
 
There's also the AUTOTAB property you can set to YES, to automatically tab to the next control once the subject control is 'filled' with data. E.g., if you have a text box with a 5-character limit, as soon as you type the 5th character, you automatically get tabbed out of the text box. This only works when you FILL the value though - a five-character text box with four characters typed in will not autotab...

Look up the AUTOTAB property for any text box (on the OTHER tab page of the property sheet)

Jim There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
I will try your suggestions. Thank you for your helps.

Haijun
 
here's another suggestion right with the autotab... put a # in the formating box within properties... that way it doesn't matter, and it will only take a number... the only problem being they will also be able to put in a 0,8,or 9... i can help you code some thing to limit the input to only those numbers if you want...

--Junior JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top