GoatieEddie
Technical User
Hi All,
I have a listbox on a Form and the listbox is called AllProducts. This code works fine and gives me the desired effect:
Private Sub AllProducts_Click()
RemoveButton.Enabled = True
ChangeButton.Enabled = True
End Sub
However, when the user clicks on another part of the form (a text box for example) I want to disable the two buttons above. I thought this would work:
Private Sub AllProducts_LostFocus()
RemoveButton.Enabled = False
ChangeButton.Enabled = False
End Sub
but it doesn't! Also, I noticed that AllProducts_GotFocus() doesn't run when someone clicks on the ListBox.
Clearly I am getting confused on how to trap the event so if someone could help and put an end to my misery then it would be most appreciated. In summary, what event do I run when a listbox loses "focus"?
many thanks,
GE
I have a listbox on a Form and the listbox is called AllProducts. This code works fine and gives me the desired effect:
Private Sub AllProducts_Click()
RemoveButton.Enabled = True
ChangeButton.Enabled = True
End Sub
However, when the user clicks on another part of the form (a text box for example) I want to disable the two buttons above. I thought this would work:
Private Sub AllProducts_LostFocus()
RemoveButton.Enabled = False
ChangeButton.Enabled = False
End Sub
but it doesn't! Also, I noticed that AllProducts_GotFocus() doesn't run when someone clicks on the ListBox.
Clearly I am getting confused on how to trap the event so if someone could help and put an end to my misery then it would be most appreciated. In summary, what event do I run when a listbox loses "focus"?
many thanks,
GE