Home All Groups Group Topic Archive Search About
Author
8 Jun 2009 7:04 PM
Melvin
I have a form with combo box and a command button.   Normally there is a
selection of some entry in the combo box and  when it loses focus some
validation is done.  The command button triggers an abort routine that halts
further processing of the form and unloads it.

The problem is that initially the focus is on the combo box so that if I
click on the abort command button  before entering anything into the combo
box the Lost focus for the  combo box executes before the actions triggered
by the abort button. How can I determine within the lost focus event of the
combo box that it really got to there because the abort command button was
clicked?

Make any sense?

Author
8 Jun 2009 7:17 PM
Bob Butler
Show quote Hide quote
"Melvin" <marvw***@columbus.rr.com> wrote in message
news:%23x374uG6JHA.3304@TK2MSFTNGP06.phx.gbl...
>I have a form with combo box and a command button.   Normally there is a
>selection of some entry in the combo box and  when it loses focus some
>validation is done.  The command button triggers an abort routine that
>halts further processing of the form and unloads it.
>
> The problem is that initially the focus is on the combo box so that if I
> click on the abort command button  before entering anything into the combo
> box the Lost focus for the  combo box executes before the actions
> triggered by the abort button. How can I determine within the lost focus
> event of the combo box that it really got to there because the abort
> command button was clicked?
>
> Make any sense?

set a flag when processing starts... better yet, have the abort button
disabled until the actions begin and disable it again when they are done
Author
8 Jun 2009 8:40 PM
Melvin
Show quote Hide quote
"Bob Butler" <noway@nospam.ever> wrote in message
news:%23dH$l3G6JHA.1420@TK2MSFTNGP04.phx.gbl...
>
> "Melvin" <marvw***@columbus.rr.com> wrote in message
> news:%23x374uG6JHA.3304@TK2MSFTNGP06.phx.gbl...
>>I have a form with combo box and a command button.   Normally there is a
>>selection of some entry in the combo box and  when it loses focus some
>>validation is done.  The command button triggers an abort routine that
>>halts further processing of the form and unloads it.
>>
>> The problem is that initially the focus is on the combo box so that if I
>> click on the abort command button  before entering anything into the
>> combo box the Lost focus for the  combo box executes before the actions
>> triggered by the abort button. How can I determine within the lost focus
>> event of the combo box that it really got to there because the abort
>> command button was clicked?
>>
>> Make any sense?
>
> set a flag when processing starts... better yet, have the abort button
> disabled until the actions begin and disable it again when they are done
>

I can possibly do something with a flag.  I  don't want to disable the abort
button as I want it active  so that at any point of completing the data for
the form I can abort the process.  For example, suppose that I got to this
form and then decided I really didn't want to use it and simply wanted to
unload the form. Or, possible started selecting data with the combo box
(there are several) THEN decided to abort the process by clicking on the
abort button.

I was hopping there was some way to bypass the lost focus procedure it the
abort button was clicked.
Author
8 Jun 2009 10:02 PM
Karl E. Peterson
Melvin wrote:
> I was hopping there was some way to bypass the lost focus procedure it the
> abort button was clicked.

In LostFocus, query ActiveControl.  Bail if needed.
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
8 Jun 2009 10:32 PM
Melvin
"Karl E. Peterson" <k***@exmvps.org> wrote in message
news:%23uleXTI6JHA.4864@TK2MSFTNGP03.phx.gbl...
> Melvin wrote:
>> I was hopping there was some way to bypass the lost focus procedure it
>> the
>> abort button was clicked.
>
> In LostFocus, query ActiveControl.  Bail if needed.
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>

Just exactly what I was looking for.  Thanks much.
Author
8 Jun 2009 7:48 PM
Henning
Show quote Hide quote
"Melvin" <marvw***@columbus.rr.com> skrev i meddelandet
news:%23x374uG6JHA.3304@TK2MSFTNGP06.phx.gbl...
>I have a form with combo box and a command button.   Normally there is a
>selection of some entry in the combo box and  when it loses focus some
>validation is done.  The command button triggers an abort routine that
>halts further processing of the form and unloads it.
>
> The problem is that initially the focus is on the combo box so that if I
> click on the abort command button  before entering anything into the combo
> box the Lost focus for the  combo box executes before the actions
> triggered by the abort button. How can I determine within the lost focus
> event of the combo box that it really got to there because the abort
> command button was clicked?
>
> Make any sense?
>
>
>
>

You can maybe, in code, set the focus to another control at start.

/Henning
Author
8 Jun 2009 8:43 PM
Melvin
Show quote Hide quote
"Henning" <computer_h***@coldmail.com> wrote in message
news:%23zU6cIH6JHA.6136@TK2MSFTNGP03.phx.gbl...
>
> "Melvin" <marvw***@columbus.rr.com> skrev i meddelandet
> news:%23x374uG6JHA.3304@TK2MSFTNGP06.phx.gbl...
>>I have a form with combo box and a command button.   Normally there is a
>>selection of some entry in the combo box and  when it loses focus some
>>validation is done.  The command button triggers an abort routine that
>>halts further processing of the form and unloads it.
>>
>> The problem is that initially the focus is on the combo box so that if I
>> click on the abort command button  before entering anything into the
>> combo box the Lost focus for the  combo box executes before the actions
>> triggered by the abort button. How can I determine within the lost focus
>> event of the combo box that it really got to there because the abort
>> command button was clicked?
>>
>> Make any sense?
>>
>>
>>
>>
>
> You can maybe, in code, set the focus to another control at start.
>
> /Henning
>
>

Henning, thanks for the response.  There are actually a number of combo
boxes and text boxes on the form that need to be filled in  sequence, so I
would need to make the extra step of  going back at some point to the combo
box out of sequence.

Mel
Author
8 Jun 2009 9:14 PM
Larry Serflaten
"Melvin" <marvw***@columbus.rr.com> wrote
> How can I determine within the lost focus event of the
> combo box that it really got to there because the abort command button was
> clicked?

Check the ActiveControl:

  Debug.Print ActiveControl.Name

If the button was clicked that would be the active control.


LFS
Author
8 Jun 2009 10:33 PM
Melvin
Show quote Hide quote
"Larry Serflaten" <serfla***@usinternet.com> wrote in message
news:%23VMOi3H6JHA.4116@TK2MSFTNGP04.phx.gbl...
>
> "Melvin" <marvw***@columbus.rr.com> wrote
>> How can I determine within the lost focus event of the
>> combo box that it really got to there because the abort command button
>> was
>> clicked?
>
> Check the ActiveControl:
>
>  Debug.Print ActiveControl.Name
>
> If the button was clicked that would be the active control.
>
>
> LFS
>
>

Larry, you and Karl both knew just what I needed.  Thanks