store multiple list box selection in text box

joeserrone

The cat of the cul-de-sac
Local time
Today, 18:44
Joined
Dec 17, 2006
Messages
164
I created a button that when pressed concatenates any items selected in a list box and places them in a text box on the form with the format of "itemselected1" or "itemselected2" or "itemselected3"

However, I need to set the criteria in a query to look at this text box and return the results based on that selection. When I do that I get no results even is the query should run fine with that type of format.

Attached is a copy of the Code for the button and the result
Dim txtValue As String
Dim varItem As Variant
Dim strlnameselect As String
Dim intCount as Integer
'Cycle through selected rows in listbox

For Each varItem In Me.Queueselect.ItemsSelected
intCount = intCount + 1
Select Case Len(txtValue)
Case 0
txtValue = Chr(34) & Me.Queueselect.ItemData(varItem)
Case Else
txtValue = txtValue & Chr(34) & " Or " & Chr(34) & Me.Queueselect.ItemData(varItem)
End Select
If intCount=Me.Queueselect.ItemsSelected.Count Then
txtValue = txtValue & Chr(34)
End If
Next
'Assign variable value to textbox
Me.Queuetorun.Value = txtValue

End Sub

the result in the text box is
"A" or "B" or "C" or "D"
 
As I posted in your other post -

does the field in your query that you want
"A" OR "B" OR "C" OR "D" actually contain ONLY THOSE LETTERS?
 
No letters but it will contain the pockets where the work is flowing into similar to this:
02
03
04
05
06
07
08
09
10
11
etc...

I need to have the query look at the text box and return the results based on the criteria
 
See my answer on the other post (and it's best to not post twice unless it is really obvious that no one is going to continue on the original).
 

Users who are viewing this thread

Back
Top Bottom