title: Multi-Select Listbox in Access 2010
body: <p>have a search form in Access 2010 that filters projects based on certain criteria and opens them in another form. One of the criteria is an unbound multi-select list box, txtArea. The data is stored in a table, ProjectActivity. There is another table called LookupArea that divides ProjectActivity by area as North, South,  or Both (ie. Having parts in north and south area).</p>
  
  <p>I also have a query, qrySelectArea:</p>
  
  <pre><code>SELECT DISTINCT Area FROM LookupArea;
  </code></pre>
  
  <p>This is the code I'm trying to work with: </p>
  
  <pre><code>Private Sub OpenReport_Click()
     Dim db As DAO.Database
     Dim qdf As DAO.QueryDef
     Dim varItem As Variant
     Dim strCriteria As String
     Dim strSQL As String
     Set db = CurrentDb()
     Set qdf = db.QueryDefs("qryLookupArea")
     If Me!txtArea.ItemsSelected.Count &gt; 0 Then
        For Each varItem In Me!txtArea.ItemsSelected
           strCriteria = strCriteria &amp; "ProjectActivity.Area = " &amp; Chr(34) _
                     &amp; Me!.ItemData(varItem) &amp; Chr(34) &amp; "OR "
        Next varItem
        strCriteria = Left(strCriteria, Len(strCriteria) - 3)
     Else
        strCriteria = "ProjectActivity.Area Like '*'"
     End If
     strSQL = "SELECT * FROM ProjectActivity " &amp; _
          "WHERE " &amp; strCriteria &amp; ";"
     qdf.SQL = strSQL
     DoCmd.OpenQuery "qryLookupArea"
  
  DoCmd.Close acForm, "Search Form"
  DoCmd.Open "ReportForm", acNormal
  DoCmd.Close acQuery, "qryLookupArea"
  
  End Sub
  </code></pre>
  
  <p>When I click the OpenReport button, the query runs (I can see it in the background while the report form opens) but the report form shows all the projects regardless of how I filter it. I'm not super big in VBA so I'd really appreciate any suggestions. </p>