Prevent combo box from automatically dropping down after the NotInList event

R

Rex Gillit

I'm using an unbound combo box as an incremental search tool with
LimitToList=Yes and Autoexpand=Yes. It does not matter to me whether the
text in the box is actually in the list or not. I'm using Response =
acDataErrContinue in the NotInList event to suppress the Access "Not in
list" dialog. However, the combo box automatically drops down. Is there any
way to prevent the automatic drop-down, or if not, a way to undrop it in
VBA?

Thanks for any advice you can offer.
 
G

G. Vaught

You are defeating the purpose of a combo box by preventing the dropdown to
appear upon the user clicking.
However, you can set the List rows to 1 under properies of the combo box
this will give the user a reduced dropdown with the spin arrows to allow
them to go up or down. I think this is your best hope.
 
R

Rex Gillit

I'm sorry; I wasn't clear enough.

I am handling the NotInList event. I only want to use the combo box to allow
the incremental search functionality. If the user types something that is
not in the list, I simply want to continue processing. For example, if they
click a button on the form while unmatched text is in the box, the button's
click event never happens. The combo box's NotInList event runs, the focus
is returned to the combo box, the box drops down, and and no further events
occur, despite the fact that I am setting the acDataErrContinue response. I
have tried sending the {F4} key in the NotInList event, but the box does not
close. Even if I position the box to a good record in the event, it still
drops down and processing stops.

I don't want to prevent the user from ever dropping down the combo box; I
just want Access not to drop it automatically after the NotInList event
fires (or at least, I want to un-drop it).
 
S

Sirocco

Please clarify something: If the text entered in the combobox isn't in the
list, exactly what do you want to happen? For the field to remain blank and
the cursor to go to the next field, or an error message (or for some value
to appear by default)?
 
R

Rex Gillit

The NotInList can be triggered if the user tabs out of the field, clicks a
button on the form, or presses [Enter]. I want the application to proceed to
whatever it would have normally done next in any of those cases if the user
had simply tabbed her way through the combo box without typing anything.
 

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