S SteveL Registered User. Local time Today, 10:54 Joined Dec 3, 2004 Messages 60 Mar 16, 2008 #1 I'd like to add a command button to my form which contains a listbox. When clicked I'd like all records to be selected. How can I do this?
I'd like to add a command button to my form which contains a listbox. When clicked I'd like all records to be selected. How can I do this?
boblarson Smeghead Local time Today, 08:54 Joined Jan 12, 2001 Messages 32,059 Mar 16, 2008 #2 First you have to have multi-select set to Simple or Extended (I like Extended). Then you use code like this: Code: Dim intCount As Integer Do Until intCount = oList.ListCount oList.Selected(intCount) = True intCount = intCount + 1 Loop I've never been good at For Each Next but you could do the same thing with that as well.
First you have to have multi-select set to Simple or Extended (I like Extended). Then you use code like this: Code: Dim intCount As Integer Do Until intCount = oList.ListCount oList.Selected(intCount) = True intCount = intCount + 1 Loop I've never been good at For Each Next but you could do the same thing with that as well.