This code allows you to use a multi-select list box   list box with multiple options) instead of a combo box on a search form front end to a query or table.  It  loops through the selected values and builds a string called “criteria” with the selected values all in it as ” OR ” options.   The example result would look like “(“OPEN” or “CLOSED” or “IN PROGRESS”)

Then it merges that string with the existing strwhere for the other search criteria picked and adds the ” and ” to it per normal.

That way people can search for more than one option from a field at a time in conjunction with other fields.

An example of the code behind ONE listbox field (status list box instead of status dropdown)


If Not IsNull(Me![cbostatus].ItemsSelected) Then                   

 ‘ Build criteria string from selected items in list box.
  criteria = “(”

  For Each i In Me![cbostatus].ItemsSelected
If criteria <> “(” Then
criteria = criteria & ” OR ”
End If
criteria = criteria & “([Project Status]= “”” & Me![cbostatus].ItemData(i) & “””)”
Next i

   If criteria = “(” Then
criteria = “”
    strWhere = strWhere
strWhere = criteria & “) AND ”
End If
End If

Jeff Shirley

Jeff Shirley

Founder & CEO
Jeff brings over 27 years of experience to the table, along with numerous awards, certifications, and real-world implementations.  His database solutions are currently running in industries including government, mining, agriculture, finance, education, science, research, non-profits, and healthcare businesses around North America and serve thousands of users day to day.  Jeff is a five-time MVP Award recipient for Microsoft Access, acknowledging contributions to community projects, evangelism, and educational outreach on Microsoft technologies.  Today there are less than 50 Access MVP’s worldwide. While Jeff focuses day to day on business management, IoT development, IT integrations and design, database architecture or other typical complex tasks, he also is a co-owner of Blue Heron Gardens, a commercial apiary running over 200 beehives.  Fresh honey is a small perk for many of our clients!

Mitch Redekopp

Mitch works with our clients day to day ensuring web development and IT projects are done to exceed customer expectations.  His background includes formal training in IT, Microsoft and CompTIA certifications, real-world business experience, and a true dedication to ensuring clients receive timely and professional support on their projects with Rivercity Technology Services.  Given the most difficult requests for IT solutions, Mitchell can assist our clients in finding a path to the best options which deliver results for our clients.  Mitchell is an avid soccer player and Manchester City fan, be sure to talk soccer with him when you can.