Run a Procedure automatically

  • Thread starter Thread starter RICHARD BROMBERG
  • Start date Start date
R

RICHARD BROMBERG

I have two combo boxes.



After the first one loses focus I manually click on the second and it runs
properly.







I want to change the operation so that when the first combo box loses focus
I want to automatically run a second procedure.



In effect I want to avoid having to manually click on the down arrow in the
Second combo box and then click on one of the items in the dropdown list.



Is there some way to do this?



I tried using DoCmd OpenQuery which kind of works but it actually opens
a new screen with the results of the Query displayed.

That's close but not exactly what I want.



Thanks
 
Call the second procedure in the LostFocus event of the first combo:

Private Sub Combo1_LostFocus()

Call MySub()

End Sub
 
RICHARD said:
I have two combo boxes.

After the first one loses focus I manually click on the second and it runs
properly.

I want to change the operation so that when the first combo box loses focus
I want to automatically run a second procedure.

In effect I want to avoid having to manually click on the down arrow in the
Second combo box and then click on one of the items in the dropdown list.


You can not use the lost focus event to change the focus to
a different control, because the focus is already in the
process of moving.

If you wait until the LoastFocus or Exit event, then the
user has already clicked somewhere outside the firs combo
box. and it will still require them to click the arrow to
drop the list.

To avoid clicking the second combo box's arrow, you need to
set the focus to the second combo box first.

Combining all that, I think you want to use the first combo
box's AfterUpdate event to move to the second combo box and
drop its list:

Me.combo2.SetFocus
Me.combo2.DropDown
 
many thanks
Dick B
Marshall Barton said:
You can not use the lost focus event to change the focus to
a different control, because the focus is already in the
process of moving.

If you wait until the LoastFocus or Exit event, then the
user has already clicked somewhere outside the firs combo
box. and it will still require them to click the arrow to
drop the list.

To avoid clicking the second combo box's arrow, you need to
set the focus to the second combo box first.

Combining all that, I think you want to use the first combo
box's AfterUpdate event to move to the second combo box and
drop its list:

Me.combo2.SetFocus
Me.combo2.DropDown
 
Back
Top