A few things - It isn't going to work like that. You will need to set the Where by using a querydef object. You can replace the whole SQL statement but you can also take this free code from Access MVP Armen Stein
http://www.jstreettech.com/files/basJStreetSQLTools.zip
and put it into a standard module and name the module basJStreetSQLTools and then you can just replace the where clause using the ReplaceWhereClause function in his code. I use it here where I work and it is great.
So, if you have that code in your database you would do this:
Code:
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
Dim strWhere As String
Dim qdf As DAO.QueryDef
Dim varItem As Variant
If Me.List0.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 criteria"
Exit_Command3_Click
End If
For Each varItem In Me.List0.ItemsSelected
strWhere = strWhere & Chr(34) & Me.List0.ItemData(varItem) & Chr(34) & ","
Next varItem
'trim trailing comma
strWhere = Left(strWhere, Len(strWhere) - 1)
strWhere = "Where FIELDNAMEHERE In(" & strWhere & ")"Set qdf = CurrentDatabase.QueryDefs("QueryNameHere")
qdf.SQL = ReplaceWhereClause(qdf.SQL, strWhere)
qdf.Close
'open the report, restricted to the selected items
Me.Form6.Requery
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Also, what is ME.FORM6.REQUERY? Is Form6 a subform on the current form? Me refers to the current form, so if you are requerying the current form then it would just be ME.REQUERY.
Also, you forgot in your other code to have the IN( ) part in there. But it still won't work that way. Also, you had your quotes in the wrong place. You had it after the comma which isn't right and so the very first one would not have a quote which would make it fail anyway.