?
Solved

Code to move cursor from Textbox1 to another Textbox in a userform.

Posted on 2012-03-12
4
Medium Priority
?
481 Views
Last Modified: 2012-03-13
I have a userform which is using code that places a date in a textbox this working well.
I would like to continue the code to then move the cursor to another textbox ready to receive typed in data.
Can someome help please.
0
Comment
Question by:user2073
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
jppinto earned 750 total points
ID: 37709122
Private Sub txtData_AfterUpdate()
    txtData = Format(txtData, "Short Date")
    txtSequencia.SetFocus
End Sub
0
 
LVL 42

Assisted Solution

by:dlmille
dlmille earned 750 total points
ID: 37710814
I would consider setting the tabIndex on all your controls in the userform to the logical sequence.  E.g., start with the control at the top left, change its tabIndex to 0, then the next to 1, all the way down to the last control button OK or Cancel, for example.  You'll find that the userform design lends itself to the sequencing of user input.

I would wait until the userform design is complete to do this, as the underlying editor messes with the tab Index as you add controls, but stabilizes once you're done, then you can set the index (order of navigation) at one time.

Generally, the index is set as you create controls, but then gets messed up quickly when you copy/paste, move them around, etc., for understandable reasons.

Cheers,

Dave
0
 

Author Comment

by:user2073
ID: 37712266
I have installed to code provided it works find except. The new problem is after I "SAVE" the record from the userform. On starting a new record the code stalls when I reset the focus back to TextBox1 instead of TextBox2 as requested is there a simple solution.
Should I dis-enable TextBox2 firstly.
I have used the code below.

The line of code:    Me.TextBox1.SetFocus

Thanks for the code in the first comment.
0
 

Author Closing Comment

by:user2073
ID: 37713784
Thanks for both solutions The advice was appreciated. I'll need to re-evaluate my question to find the final answer to my questions.

Thanks for your efforts.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question