+ Reply to Thread
Results 1 to 3 of 3

Use .text from previous text box in form to prefill text in second text box

  1. #1
    Registered User
    Join Date
    01-12-2010
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Use .text from previous text box in form to prefill text in second text box

    We have 2 text boxes txtFirst and txtSecond in a form.

    When we tab from textFirst to txtSecond we would like the text from the first text box to show as the text for the second text box.

    The code txtSecond.text = txtFirst.text makes the text appear. The problem is, we would like to be able to edit the text in the second text box if need be.

    What happens is the text shows up in txtSecond BUT, we do not get a chance to edit the text. The code that is in Private Sub txtSecond_AfterUpdate immediately begins to run.

    What is needed is for the cursor to stop at the textbox, with the contents highlighted ready to be edited if need be.

    No matter what we try, we cant get the text box to prefill with text from the previous tab & stop in the field with the text higlighted ready or editing.

    I apologize if I haven't been able to state the problem clearly.

    As always, thanks in advance for any help.
    Last edited by chromachem; 03-23-2012 at 10:13 PM.

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Use .text from previous text box in form to prefill text in second text box

    if you put your code in the txtFirst_AfterUpdate sub then you should get the desired result.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    01-12-2010
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Use .text from previous text box in form to prefill text in second text box

    I went back to this problem after completing the subroutine. I put the code as the last line of txtFirst. I did get the desired result. Thanks for your help. You were 100% correct.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1