Error '2110' Cannot move Focus

ejstefl

Registered User.
Local time
Today, 13:51
Joined
Jan 28, 2002
Messages
378
Hello all,

I don't like the look of Combo boxes on forms, especially on Continuous forms made to look like a spreadsheet. I think the arrow is distracting, and since you cannot change its color frequently looks bad. My plan was to use two controls - a text box, and a combo box. I would have the combo box hidden and the text box visible. When the user clicked on the text box, I would make the combo box visible, and hide the text box. Then, when the user left the field, I'd hide the combo box and reveal the text box.

Here is the code I used:

Code:
Private Sub cboPlayerID_LostFocus()

    Me.txtPlayerName.Visible = True
    Me.txtPlayerName.SetFocus
    Me.cboPlayerID.Visible = False

End Sub

Private Sub txtPlayerName_GotFocus()

    Me.cboPlayerID.Visible = True
    Me.cboPlayerID.SetFocus
    Me.txtPlayerName.Visible = False

End Sub

The first procedure runs fine, and when I click on the text box it changes to a combo box. However, when the second procedure runs, I get error 2110, cannot move focus.

Any ideas why I get this error, or any ideas of a better way to accomplish this??

Thanks,
Eric
 
Try this,

Place the text box on top of the combo box, (be sure it is on top by clicking Format>Bring to front).

Then use just this code:

Code:
Private Sub cboPlayerID_LostFocus()
    Me.txtPlayerName.Visible = True
End Sub

Private Sub txtPlayerName_GotFocus()
    Me.cboPlayerID.Visible = True
    Me.cboPlayerID.SetFocus
    Me.txtPlayerName.Visible = False
End Sub
 
That works, thank you!
 

Users who are viewing this thread

Back
Top Bottom