I use a generic function to retrieve the values of a multiselect listbox (below)
you can then easily construct a where clause such as - ...Where [MAchine ID] in (" & getLBX2(me.YourListboxName) & ")"
Code:
Public Function getLBX2(lbx As ListBox, Optional intColumn As Variant = 0, Optional Seperator As String = ",", _
Optional Delim As Variant = Null) As String
Dim strList As String
Dim varSelected As Variant
If lbx.ItemsSelected.Count = 0 Then
'MsgBox "Nothing selected"
Else
For Each varSelected In lbx.ItemsSelected
strList = strList & Delim & lbx.Column(intColumn, (varSelected)) & Delim & Seperator
Next varSelected
strList = Left$(strList, Len(strList) - 1) 'remove trailing comma
End If
getLBX2 = strList
End Function