question on listbox

S

SF

Hi,

I have a form with a listbox (lstNames) and a button (btnEdit) to edit name.
This button is disable when form is open to prevent use opening the
frmEditName unless user select a name in the lsitbox (lstNames). I want to
enable the button when the listbox is clicked/selected. How can I do that?

SF
 
K

Ken Snell \(MVP\)

Use AfterUpdate event of the listbox:

Private Sub lstNames_AfterUpdate()
Me.btnEdit.Enabled = (IsNull(Me.lstNames.Value) = False)
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

Top