Consulting

Results 1 to 8 of 8

Thread: Change Tab Order for Word Form does not work: skips one field

  1. #1
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    4
    Location

    Change Tab Order for Word Form does not work: skips one field

    I tried Q212378 from MS KB in order to change the tab order on a form. The same basic approach appears in several MVPs sites. However, when I try it, what ends up happening is that the Exit event gets fired twice (once on the original field and then once again, reporting the destination field for the first redirect), so what ends up happening is that the third is selected. Let me try to show what I need. This is the layout and tab order of the fields I need:

    1 4
    2 5
    3 6

    But, instead of the Exit event getting fired once for (1) and moving on to (2), it gets fired twice, once for (1), and then for (2), so the cursor moves to field (3). I guess it might have to do with timing, but I tried several tricks and still doesn't seem to work...

    What kinda irks me is that I have seen several samples where this seems to work fine, but they are password-protected, so I can't read the view the source code...

    Any ideas or suggestions?

    Arturo

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Maybe this will help...
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    4
    Location

    Set Tab Order: Skipping

    Actually, that was exactly the code I tried first, which is the one that goes on skipping fields (upon exit of 1, goes to 3 instead of 2, and so on)... so, thanks, but it doesn't seem to work.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If you read it then you know they suggest a userform solution.....can that be implemented into your project?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    4
    Location

    Thumbs up Word forms tab order: skipping

    Thanks for the suggestion. Normally, I would use a User Form to capture complex information, but for this particular application, it would be too obtrusive for the users. The idea for changing tabs is that it would make filling the form flow more smoothly: the left side is the "From" of a courier slip, and the right side is the "To".
    In the end, I just managed to get this solved, but is a rather nasty tweak. I turned on a timer, and did not process "on exit" events until the timer ended. When the timer finished (1 sec), it would just go to the appropriate field, and then it works, although you do get a weird flick when the selected field moves around a bit until it returns to the right destination. I guess this will have to do for now...

    Thanks a lot!

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try
    [VBA]
    application.screenupdating = False
    [/VBA]
    at the begining of your routine and be sure to return it to true at the end. That might help with the screen flickering.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    4
    Location
    Thanks... indeed, it looks much better now!

  8. #8
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Arturo, please mark your thread solved if it is using the thread tools at the top of the page..you can still post follow up questions if you need to.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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