title: Run-time error '3075': syntax error in query expression
body: <p>I am creating a form on Access to filter a Subform based on the Column name "Control Type".</p>
  
  <p>I am using a listbox to choose multiple values to filter with.</p>
  
  <p>I also have a button that will execute the filter to the form.</p>
  
  <p>I wrote this code:</p>
  
  <pre><code>Private Sub cmdSearch_Click()
  Dim varItem As Variant
  Dim strSearch As String
  Dim Task As String
  
  For Each varItem In Me!listControl.ItemsSelected
       strSearch = strSearch &amp; "," &amp; Me!listControl.ItemData(varItem)
  Next varItem
  
  If Len(strSearch) = 0 Then
       Task = "select * from tblAB"  
  Else
       strSearch = Right(strSearch, Len(strSearch) - 1)
       Task = "select * from tblAB where Control_Type = '" &amp; strSearch &amp; "' "
  End If
  Me.tblAB_subform.Form.Filter = Task
  
  Me.tblAB_subform.Form.FilterOn = True
  
  End Sub
  </code></pre>
  
  <p>I am getting a Run=time error '3075' for the line:</p>
  
  <pre><code>Task = "select * from tblAB where Control_Type = '" &amp; strSearch &amp; "' "
  </code></pre>