Ah, stai usando un controllo listbox.![]()
Una volta generata la query ci fai quel che vuoi.codice:Private Sub Comando11_Click() Dim strSQL As String Dim i As Integer If Elenco.ItemsSelected.Count = 0 Then MsgBox "selezionare almeno una voce" Exit Sub End If strSQL = "select * from prova where 1<>1 " For i = 0 To Elenco.ListCount - 1 If Elenco.Selected(i) Then strSQL = strSQL & "or " & Elenco.Column(0, i) & "=-1" End If Next i MsgBox strSQL End Sub![]()