Combobox Drop down

  • Thread starter Thread starter Niklas Östergren
  • Start date Start date
N

Niklas Östergren

Is it possible to check a combobox drop down status?

I´d like to test if a combobox allready is open. And if so close it when I
press <Enter>.

I allready have following code in the combobox on Change_Event:

Me!cboSearchFileName.Dropdown

And in the combobox AfterUpdate_Event this code:

'Close drop down of combobox
SendKeys "{F4}"

This does following:
- Change_Event = Open combobox when the user types the first sign
(character). Displaying the selectable records.
- AfterUpdate_Event = Closes the combobox when user work´s with the mous.

BUT:
This gives the effect that if the user opens up the combobox with help of on
Change_Event it will NOT close when the user select a record with <Enter>.
Focus do change to the listbox which is next but the combobox is still open.
Quit anoying!

TIA!
// Niklas
 
Hi Niklas

As far as I am aware, a combo box which does not have the focus CANNOT be
dropped down. I don't understand how what you describe can be happening.
Also, selecting a value from a combobox should cause it to close its dropped
down list, so your AfterUpdate procedure should be unnecessary. Can you
give some more details?
 
Hi Graham!

Well if I comment away the code (SendKeys "{F4}") from the comboboxés
AfterUpdate_Event. The combobox closes when I use <Enter_key> to select a
record. But it stays open if I use the mous to select the record.

If I activate the code in AfterUpdate_Event vice versa happens. Combobox
closes if I use the mous but not if I use <Enter>.

When I use mous, on both ocations, I first click on the arrow to open the
combobox THEN select the record.

That´s about it!

It´s a little bit late here in Sweden (22:30) and it´s working day tomorrow
so I might not be able to se any answer until tomorrow!

Tank´s for taking time trying to help me out!

// Niklas


Graham Mandeno said:
Hi Niklas

As far as I am aware, a combo box which does not have the focus CANNOT be
dropped down. I don't understand how what you describe can be happening.
Also, selecting a value from a combobox should cause it to close its
dropped down list, so your AfterUpdate procedure should be unnecessary.
Can you give some more details?
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Niklas Östergren said:
Is it possible to check a combobox drop down status?

I´d like to test if a combobox allready is open. And if so close it when
I press <Enter>.

I allready have following code in the combobox on Change_Event:

Me!cboSearchFileName.Dropdown

And in the combobox AfterUpdate_Event this code:

'Close drop down of combobox
SendKeys "{F4}"

This does following:
- Change_Event = Open combobox when the user types the first sign
(character). Displaying the selectable records.
- AfterUpdate_Event = Closes the combobox when user work´s with the mous.

BUT:
This gives the effect that if the user opens up the combobox with help of
on Change_Event it will NOT close when the user select a record with
<Enter>. Focus do change to the listbox which is next but the combobox is
still open. Quit anoying!

TIA!
// Niklas
 
Well if I comment away the code (SendKeys "{F4}") from the comboboxés
AfterUpdate_Event. The combobox closes when I use <Enter_key> to select a
record. But it stays open if I use the mous to select the record.

If I activate the code in AfterUpdate_Event vice versa happens. Combobox
closes if I use the mous but not if I use <Enter>.

When you use the mouse, the SendKeys in the afterupdate event causes the
combobox to open again (the focus remains on the combo box); when you press
enter, the focus leaves the combo box and the combo box has no choice but to
close.
 
Back
Top