List Box Select All Option

  • Thread starter Thread starter Dave F
  • Start date Start date
D

Dave F

I have a list box called "ListAsset" that has numerous entries. How can I
program a checkbox to select all the entries in the list box (ListAsset) and
disable the list box, but when the checkbox is unchecked it enables the list
box?

Thanks,
Dave F
 
Hi Dave

The following code will select/unselect all the items in the list and
disable/enable the listbox if the checkbox chkSelectAll is
checked/unchecked:

Dim i As Integer
With ListAsset
For i = 1 To .ListCount - 1
.Selected(i) = chkSelectAll
Next
.Enabled = Not chkSelectAll
End With

I suggest you put in the checkbox's AfterUpdate procedure.
 
Thanks!

Worked perfect.

Dave F.

Graham Mandeno said:
Hi Dave

The following code will select/unselect all the items in the list and
disable/enable the listbox if the checkbox chkSelectAll is
checked/unchecked:

Dim i As Integer
With ListAsset
For i = 1 To .ListCount - 1
.Selected(i) = chkSelectAll
Next
.Enabled = Not chkSelectAll
End With

I suggest you put in the checkbox's AfterUpdate procedure.

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Dave F said:
I have a list box called "ListAsset" that has numerous entries. How can I
program a checkbox to select all the entries in the list box (ListAsset) and
disable the list box, but when the checkbox is unchecked it enables the list
box?

Thanks,
Dave F
 
Back
Top