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
 
Back
Top