pass value from a text box to a bound combobox and force AfterUpdate Event

T

thebridge

Hi,
When I pass a value from MyTextBox to MyComboBox using:

Me.MyTextBox = Me.MyComboBox

It does Not trigger the AfterUpdate Event of the ComboBox

I need it to! Any Suggestions??

I have tried: copy and pasting by but that creates a problem

Me.MyTextBox = BarCodeData$ 'passes the variable value to MyTextBox
Me.MyTextBox .SetFocus
Me.MyTextBox .SelStart = 0
Me.MyTextBox .SelLength = Len(Me.MyTextBox ) + 1
SendKeys "^c" 'copies the value of of MyTextBox

as soon as I add the below line, it no longer copies the value in
MyTextBox
Me.MyComboBox.SetFocus

The onEnter Event of MyComboBox has the following code that works fine.

Private Sub cboLookupPart_Enter()

Me.MyComboBox.SetFocus
Me.MyComboBox.SelStart = 0
Me.MyComboBox.SelLength = Len(Me.MyComboBox.Text)
SendKeys "^v"

End Sub

If I ran all the code above, all works but the "Copy" and thus anything
that may be in the clipboard is pasted into MyComboBox, and the
AfterUpDate of MyComboBox triggers.

I know that there are compelling reason NOT to use the SendKeys but I
was just trying something

What I'd really like to do is eliminate MyTextBox and pass the Variable
directly to MyComboBox:

Me.MyComboBox= BarCodeData$

And have it force the AfterUpdate Event of MyComboBox

Eagerly awaiting suggestions!

Thank you,
Robert Bloomfield
 
J

Jeff Boyce

Robert

If you want to set [MyComboBox], you'd need to reverse that equation... that
is, you want

MyComboBox to be = MyTextBox

If you want the AfterUpdate event of MyComboBox to be triggered, you can
call it in code:

Call MyComboBox_AfterUpdate()

Why? As in why do you need to "load" a combo box?

I ask because there may be something you want to accomplish by doing this,
and newsgroup readers may be able to offer another approach.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Similar Threads


Top