Question

I am trying to make a label display different instructions depending on which text or combo box currently has focus.

The problem is the label will only display the instruction text when I actually start typing something in the control, not when it is clicked on or tabbed to.

I have searched around and found a few suggestion such as (control is me.activecontrol...etc) but these don't solve my problem, and I don't want to force the focus with .setfocus. I just want it to display when the user focuses on the control on their own.

My current code: (I did try the other suggestions and made no progress)

Private Sub cmbPurposeID1_Change()    
     lblInstructions.Caption = "random text here."
End Sub'
Was it helpful?

Solution

You should use the Enter events, eg

Private Sub cmbPurposeID1_Enter()    
     lblInstructions.Caption = "random text here."
End Sub

From VBA help: Enter occurs before a control actually receives the focus from a control on the same form

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top