collapse combo

T

Tara

I have a combo box used for selecting the client record the user wants to
work with. I have autoexpand set to Yes. When you begin typing, the combo
automatically drops down to make several selections visible at once. Once
the user finds the correct client and clicks on the name, the form displays
that client's data. The problem is that once the client is chosen, the combo
box remains open. I want the user to click on a client and then have the
combo collapse. How do I make that happen?

Thanks!
 
M

Michael Gramelspacher

I have a combo box used for selecting the client record the user wants to
work with. I have autoexpand set to Yes. When you begin typing, the combo
automatically drops down to make several selections visible at once. Once
the user finds the correct client and clicks on the name, the form displays
that client's data. The problem is that once the client is chosen, the combo
box remains open. I want the user to click on a client and then have the
combo collapse. How do I make that happen?

Thanks!

Try putting this in the On Click event of the combobox:

SendKeys "{tab}"
 
L

Linq Adams via AccessMonster.com

Actually, using SendKeys is always a bad idea, for reasons that have been
documented here and elsewhere for years! But Michael's general idea is spot
on. You need to move focus to any other control on the form, and the combobox
will close. Substitute the name of any textbox on you form for AnyTextBox:

AnyTextBox.SetFocus
 
T

Tara

I tried your suggestion, but I got a Run-Time error (2185). It says: You
can't reference a property or method for a control unless the control has the
focus.

I'm sure this has to do with the fact that I already have code in the
OnClick event that forces the combo to dropdown.

Do you have any other suggestions?

Thanks!
 

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