Rivercity Technology Services LTD Logo
HomeAbout Us
Technology Services
Icon showing a support technician
IT Support Services
Cybersecurity Risk Management at one predictable flat rate.
Icon of light bulbs on a laptop screen
IT Consulting
Business optimization through the smart use of technology.
Icon showing a hand holding a phone
Business Phone Services
VoIP Telephone solutions from RCT. 
Icon showing a database and a cloud
Backups & Recovery
Cloud & On Premise - ready to recover!
Icon showing computer code on a monitor
Software Development
Web & Mobile App development
Icon showing website wireframes
Website Development & Hosting
Web design and full hosting & maintenance packages!
Icon showing an envelope being opened
Modern Email Management
Microsoft 365 email provisioning, security & management.
“You’re giving me the ‘it’s not you, it’s me’ routine? I invented ‘it’s not you, it’s me.’ Nobody tells me it’s them not me; if it’s anybody, it’s me.”
- George Costanza
Learning CenterContact Us
Book A Consultation
Illustration of a person writing a blog post with a pencil

Making A List Box With Multiple Options

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
Article Written by Jeff Shirley
Related Articles
Featured image
Your Guide to Managed Website Hosting
Creating a website is only the first step. Keeping it online and accessible to visitors 24/7 involves a lot of additional work. Hosting your site means choosing...
2022 - Copyright, All Rights Reserved