browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need Microsoft Access / VBA help?

Get answers from our community of Microsoft Access / VBA experts on BYTES! It's free.

Combo Box - Enter a value without triggering an update?

OhFiddleSticks
Guest
 
Posts: n/a
#1: Nov 12 '05

Does anyone know if there is a way to add a text value to a combo box (the
text box part, not the rowsource) in VBA without triggering an update
event? I've tried everything I can think of without success.

What I want is a combo box that I set the rowsource for in VBA and requery
it, then it drops down, and enters a probable selection that may or may
not already be in the list to the text box portion. Then I can manually
compare the probable selection to the contents of the dropdown and decide
whether to select an option already in the dropdown...or use the value
that was pasted in the textbox.

My problem is when I try to paste this probable selection into the combo
box. I have tried using sendkeys to copy and paste, DoCmd.RunCommand
acCmdPaste, and just setting the value based on that of another text box.
These methods always trigger the afterupdate event, onnotinlist event,
close the dropdown of the combo box, or all of the above. When I manully
copy and paste a value into the combo box though this does not happen. Is
there a way to put a value in there without actually "submitting it", or
maybe a way to only allow the field to be updated if I hit enter or click
to select an option.

I'm using Access 2002 with an ADP with SQL Server 2000 if it makes a
difference.

Any help would be very much appreciated.



OhFiddleSticks
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Combo Box - Enter a value without triggering an update?


Thanks for the advice. I had actually tried that as well, with the same
problem result. I may have stumbled upon a workaround for the problem
though. It seems to be working so far. I
setfocus,dropdown,setfocus,paste value,then dropdown again. It seems to
make a difference if you do a send keys or use a command for certain
actions or combinations of actions. Certain combinations acted
differently eventhough they all were supposed to do the same thing.

Me.Control.SetFocus
SendKeys "{F4}", True
Me.Control.SetFocus
DoCmd.RunCommand acCmdPaste
SendKeys "{F4}", True

Thanks again

On Fri, 05 Sep 2003 02:38:04 GMT, Allen Browne
<abrowne1_SpamTrap@bigpond.net.au> wrote:
[color=blue]
> If the combo has focus, you could try setting the Text of the combo.
>[/color]

Closed Thread