I'm using the following code to set multiple values from a LIST BOX as parameter. The problem is when I select more than 1 value the query returns nothing at all, but if i select 1 value the query will work. All my code seems correct, but can a query take criteria from a text box like I have done in my code? For example the text box will populate: 201 or 202 or 236 or 245 or 389 ... and no results in my query will be return. The criteria in my object query is [forms]![form]![txtParameter]
Any help would be great!!!
Any help would be great!!!
Code:
Private Sub btnSub_Click()
Dim ctl As Control
Dim varItm As Variant
Dim stItem As String
Set ctl = Me!lstTran
For Each varItm In ctl.ItemsSelected
stString = stString & IIf(stString = "", "", " or ") & ctl.Column(0, varItm)
Next varItm
Me.txtParameter = stString
DoCmd.OpenQuery "zzzfinaltrial"
End Sub