Set Focus

  • Thread starter Thread starter dhstein
  • Start date Start date
D

dhstein

I thought I had this solved - but it looks like I don't. I set a combo box
to visible - and let the user select a value. I want to read that value and
then move the focus to another control and set the combo box to invisible
again. But I can't seem to get the focus off of the combo box. I've tried
this in the "After Update" event and the "Change" event - but I always get
the runtime error 2110 - can't set the focus etc. etc. Any help is
appreciated.

David
 
You will not be able to use the Change event, which essentially runs after
every key stroke, but the After Update event should work:

Me.SomeControl.SetFocus

Assuming you are able to move the focus, try hiding the combo box in the Got
Focus event of the control to which you are moving the focus.

When posting a question about troublesome code it usually helps to post the
code.
 
Bruce,

Thanks for your reply - but I can't move the focus. The code is below:

Private Sub cbxFindVendor_AfterUpdate()

Me.txbVendorName = Me.cbxFindVendor.Value

VendorNameIs = Me.cbxFindVendor.Value

Me.cbxFindVendor.Value = ""


'Runtime Error 2110 on next line
Me.txbVendorName.SetFocus


Populate_Vendor (VendorNameIs)
End Sub
 

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

Set Focus 3
Set the focus 3
Changing the focus 2
Hiding a control After it lost focus 2
set focus 1
Combo Box, events and keyboard questions.. 7
Combo Box not firing OnChange Event 5
Auto DropDown Combo Boxes 8

Back
Top