Hi all, I am an amateur access developer mostly trained by Google searches & YouTube, so please be gentle with me 
Background - I built a database for my department that stores 100's of clinical trials, so we can keep track of where everything is up to.
I have created a search page that has multiple criteria using combo boxes, list boxes and free text. I've attached the full SQL code for reference.
At the moment, when I select a Specialty using the list box, the code runs through the list box criteria selected, adds this to the variable strSpec, then adds the combined specialties into the strWhere and continues with the rest of the search criteria.
Help Request -
Some trials cover multiple specialties. I have another field called MulipleSpecialty and when the user creates or updates a record, they can select Multiple in the Specialty field then use a multi seclect combobox to store all the related specialties in a string in MultipleSpecialty.
I'd like to be able to check if the Specialty field = "Multiple", then search through the MultipleSpecialty field to compare against what has been selected in the list box, lst_spec
(as a side note, the string in MultipleSpecialty is a number field, and stores the IDs of the specialties selected from tbl.Specialties)
Here is an exert from the code building the Specialty criteria.
'SPECIALTY CRITERIA
'Build the specialty criteria string by looping through the listbox
For i = 0 To lst_spec.ListCount - 1
If lst_spec.Selected(i) Then
strSpec = strSpec & "'" & lst_spec.Column(0, i) & "',"
End If
Next i
' strip off the last comma
If Len(strSpec) > 0 Then
strSpec = Left(strSpec, Len(strSpec) - 1)
End If
' if nothing has been selected then don't add to the strwhere
If Len(strSpec) > 0 Then
strWhere = strWhere & "[Specialty] in (" & strSpec & ") AND "
End If
Thanks in advance for any help or advice,
Andy M

Background - I built a database for my department that stores 100's of clinical trials, so we can keep track of where everything is up to.
I have created a search page that has multiple criteria using combo boxes, list boxes and free text. I've attached the full SQL code for reference.
At the moment, when I select a Specialty using the list box, the code runs through the list box criteria selected, adds this to the variable strSpec, then adds the combined specialties into the strWhere and continues with the rest of the search criteria.
Help Request -
Some trials cover multiple specialties. I have another field called MulipleSpecialty and when the user creates or updates a record, they can select Multiple in the Specialty field then use a multi seclect combobox to store all the related specialties in a string in MultipleSpecialty.
I'd like to be able to check if the Specialty field = "Multiple", then search through the MultipleSpecialty field to compare against what has been selected in the list box, lst_spec
(as a side note, the string in MultipleSpecialty is a number field, and stores the IDs of the specialties selected from tbl.Specialties)
Here is an exert from the code building the Specialty criteria.
'SPECIALTY CRITERIA
'Build the specialty criteria string by looping through the listbox
For i = 0 To lst_spec.ListCount - 1
If lst_spec.Selected(i) Then
strSpec = strSpec & "'" & lst_spec.Column(0, i) & "',"
End If
Next i
' strip off the last comma
If Len(strSpec) > 0 Then
strSpec = Left(strSpec, Len(strSpec) - 1)
End If
' if nothing has been selected then don't add to the strwhere
If Len(strSpec) > 0 Then
strWhere = strWhere & "[Specialty] in (" & strSpec & ") AND "
End If
Thanks in advance for any help or advice,
Andy M