Clear a multi selection list box

U

Ulcom

Hi

I have on a form a list box named MultiDomaine

It contains around 100 records (from a table) I select let say 15 items
then I print the report. After I have to select 9 other different items for
another report so I would like to have a button that would reset the list
box.
I have try many things but without any result.

Another question

right now i have download 300 messages out of thousands. Is there a way to
search through all these messages because I am quite sure that somebody have
already ask the same question

Thanks
 
W

Wayne Morgan

The best way to search through the questions is to use Google Groups.

Here is an example to clear all selections in a multiselect listbox.

On Error GoTo CheckError
Dim i As Integer, strMsg As String
If lstFamilyPosition.ListCount = 0 Then Exit Sub
For i = 0 To lstFamilyPosition.ListCount - 1
lstFamilyPosition.Selected(i) = False
Next i

Cleanup:
Exit Sub

CheckError:
strMsg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox strMsg, vbOKOnly + vbExclamation, "Error", Err.HelpFile,
Err.HelpContext
Resume Cleanup
 
Top