Function Clear the Selected Items from the List Box
VBA Code:
Public Function ClearSelectedItem(lst As ListBox) As Boolean Dim varItem As Variant If lst.MultiSelect = 0 Then lst = Null Else For Each varItem In lst.ItemsSelected lst.Selected(varItem) = False Next End If End Function
How to Use It:
Put the VBA code above in the Module and call it on the click button anywhere on your Access file where you want to unselected items from the listbox.
Example:
if you have a list box names “lstCustomerType”
then put this code under the click button like:
Private Sub Command2_Click() Call ClearSelectedItem(Me.lstCustomerType) End Sub