Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love this site! It's so nice to know that there are so many people out there who are willing to share their knowledge..."

Geography

Where in the world do Tek-Tips members come from?
LARiot (Programmer)
9 Aug 12 19:11
Hi. Thanks for looking into this.

As with any thread, please only reply after reading carefully. Also only if you are sure of the correct answer. No one likes to read a bunch useless posts before getting to the right answer. Especially when they have to read more than one post.

In the OnExit event of a text box I have the following:

CODE

Me.txtJobNumber.SetFocus 

However, the following textbox gets the focus when the user tabs to another control. What's probably happening is that the txtJobNumber does get the focus then vba goes back to what it was going to do and changes the focus to the next control on tab index sequence.

How do I set the focus back to txtJobNumber from it's own event?

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor

LARiot (Programmer)
9 Aug 12 19:15
Please forgive me if you find the beginning of my previous post offensive. I have made the mistake myself in the past.

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor

MajP (TechnicalUser)
9 Aug 12 19:37
I cannot replicate this but my first thought would be to add doevents prior to setting the focus. That way it would finish processing any other cached events before setting the focus. Sorry if this is an incorrect "useless post" and wasted your valuable time.
dhookom (Programmer)
9 Aug 12 20:50
"How do I set the focus back to txtJobNumber from it's own event?"
Try set the focus somewhere else and then set the focus back to txtJobNumber.

Duane
Hook'D on Access
MS Access MVP

missinglinq (Programmer)
14 Aug 12 22:37
Why are you returning Focus to the Control that just lost it? The most common reason for doing this is that something has gone awry, such as a Validation failing because incorrect data was entered. This type of thing is usually checked in the Control's BeforeUpdate event, and the Focus will remain in the Control, using this event, if you Cancel the Update by using

Cancel = True

Linq ;0)>

The Missinglinq

Richmond, Virginia

The Devil's in the Details!

LARiot (Programmer)
15 Aug 12 14:40
MajP: Thanks for your response. You are certainly not wasting my time.

Perhaps it was unwise of me say "useless".

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor

strongm (MIS)
15 Aug 12 14:43
>I cannot replicate this

I can - and I second missinglinq's suggestion of simply cancelling the Exit event to avoid the issue

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close