Combo box does not react on first click

  • Thread starter Thread starter RichardGarfield
  • Start date Start date
R

RichardGarfield

I have 5 combo boxes on a form and all except one accept the chosen row at
the first click. I am tearing my hair out trying to find why only this one
reacts when it is dropped down and the row is clicked for the second time.

Please someone show me how stupid I am being.
 
Richard -

Could you have used the double-click event for your code instead of the
click event?
 
Hi Daryl

Thanks for the suggestion. Unfortunately I don't use any click event. On
GotFocus it drops down automatically, and then reacts OnUpdate.

Richard
 
Richard -

Does it not highlight on the first click, or does it highlight on the first
click but not execute code until the second click? Is this combo box bound
to a field in the recordsource?
 
Hi Daryl

Let me explain. The combobox is bound to a query and drops down on getting
focus. When you click on your choice, it closes without showing the choice in
the box. AfterUpdate fires with the box blank and it jumps to the next
control.
When you then return to it, drop it down again and choose, it shows the
correct choice.

Does that help?

Richard
 
Richard -

I'm not sure what is going on.

I would suggest adding some debug.print me.combobox.column(0) statements
(using your combobox name) in a few places:

GetFocus
Click
AfterUpdate

Then put a breakpoint in the top of each of these and see what the value is,
the first time through and the second. See where it is changing.

If you want to force a value, you can use the AfterUpdate event of the
control, and if the value is blank, you can drop down the list again.
 
Daryl

Curiouser and curiouser...when it first gets focus and dropsdown, and I run
the cursor over it, it is dead and does not react to the cursor. But when I
click on the dropdown, it closes and leaves the box empty. It does not fire
the AfterUpdate either. When I drop it down manually the second time, the
reacts normally.

Any more ideas?

Richard
 
Richard -

Does this control have the focus before it is clicked on? Is there anything
in the prior droplist that hasn't completed when the droplist first drops?
What could be different between this one and the other dropdowns?
 
Daryl

Have found the problem but not the answer.

When I tab out of the previous control to the listbox, it works fine. If I
hit enter out of the previous control, it doesn't.

??

Richard
 
Richard -

Good detective work. I don't know why that would matter - I thought both
would move focus to the next control. You could try putting code in the
KeyDown event - if it is Enter, change it it Tab?

Does this mean everything works correctly if the user hits tab from the
controls and not Enter? Is each control doing this, or is the difference in
just the last control?
 
Back
Top