Not sure about using a toggle button for this is the best idea but ....
To select all the items in a list box
With Me.ListBoxName
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With
This is normally used to do "something" so you could use
Public Sub SomeButtonName_Click()
Dim varItem As Variant
With Me.ListBoxName
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With
For Each varItem In Me.ListBoxName.ItemsSelected
'add what you want to do in the section - like print reports, etc'
This is not exactly an answer to your question, but it does show how to
return all records. It does not literally select all of the items, but
rather returns a recordset that is equivalent to selecting all. http://www.mvps.org/access/forms/frm0043.htm
Awesome! Works Perfectly! Thank you very much Wayne!!
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.