If listbox empty then button not visible/disabled

adamtate94

Registered User.
Local time
Today, 07:56
Joined
Sep 6, 2016
Messages
31
Hi

I have a listbox on a form which has text values put into it when a checkbox is ticked, I also have a save button underneath it that executes an SQL insert statement.

I need the save button to not be visible/not work when there is nothing in the list box or where there has been nothing put into it.

I am wondering what Event to put some code onto and a little help with the code it's, would it be a simped If me.ListBox ... then Me.txtBox.visible -=false?

Thanks in advance
 
If the listbox is only populated after the checkbox is ticked , I would disable the save button until the checkbox is ticked?
If you enable / disable the button it is dimmed out when not available, which is a good visual clue to end users that something needs to be done to enable it, rather than hiding it completely.
 
Yes that sounds sensible, where in my code should I put it? which event?
That is all im struggling with :)
cheers
 
I have a button that when clicked populates with listbox with everything that it ticked
 
Simply save the button on the form as Enabled = false in it's properties.
Then on your populate listbox button add the one line of code Me.YourcmdSaveButton.Enabled = True.

If you have another button that clears the list box you can disable the save button again at that point.
 

Users who are viewing this thread

Back
Top Bottom