de-select items in a listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way using VBA to unselect (deselect) all entries in a multi-select
or single-select listbox?

Thanks in advance for your help!
 
PeterM said:
Is there a way using VBA to unselect (deselect) all entries in a
multi-select or single-select listbox?

Thanks in advance for your help!

A single-select list box is easy: just set its value to Null.

For a multiselect list box:

'----- start of code -----
Function ClearListBoxSelections(lst As Access.ListBox)

Dim intI As Integer

With lst
For intI = (.ItemsSelected.Count - 1) To 0 Step -1
.Selected(.ItemsSelected(intI)) = False
Next intI
End With

End Function

'----- end of code -----
 

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

Back
Top