Cancel On Lost Focus Event

H

Hugh self taught

Hi everyone,

Is there a way to cancel the "On Lost Focus" event if another event has
fired first?

My scenario is a cbo that looks up a record. I use the afterupdate if I find
the record. I use the "not in list" with options to add a record or select
from another cbo if the item is not in th list. However if the user tabs
through the cbo without entering anything, I need to know so I use the "on
lost focus".

The problem is as soon as I exit sub to move the control, the "on lost
focus" event code executes. Any suggestions as I've been unsuccessful so far.

P.S.
I can't use the form's before update as I hide controls & make others
visible depending on the options chosen.
 
M

Maurice

As you state in your post you want to check if the cbo has been touched.
Isn't that an option to check then? Check to see if the cbo value isnull or
check to see if the old value is still there in the cbo or something like
that before you trigger the next event. The focus events are very hard to use
for situations like this because you never know where the user is going to
start. You might also consider setting various options to disabled as long as
no choice has been made in the cbo.
 
H

Hugh self taught

Hi Maurice,

I hear what you say but I can't place in my mind how I will get to do that
checking as there are 3 exit paths from the cbo determined by what happened
in the cbo.

1 Valid data was selected so I go AfterUpdate
2 Invalid data was typed so NotInList will automatically fire
3 The user either "tabs" out of the cbo or mouse clicks on another control.

If 3 above, then controls get hidden & others made visible & focus moved. If
they moved via mouse then how will I determine if cbo was "empty" since I
don't know which control they are currently on? If they "tab"out then I know
which control they will be on so can deal with it there so maybe "disabling"
mouse click? otherwise "on click" becomes another event to monitor.

Suggestions or thoughts?
 
D

Dennis

Could you use the On Exit event for the cbo? You can Cancel that and return
the focus to the control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top