J
javablood
Hi,
I have a form in which several choices are selected, one of which is a list
box in which the user can make multiple selections. I followed the various
suggestions to create a String that has the selected items and I set a
textbox in the form as that final String as follows:
Dim Criteria As String
Dim ctl As Control
Dim Itm As Variant
' Build a list of the selections.
Set ctl = Me![lboSTATID]
For Each Itm In ctl.ItemsSelected
If Len(Criteria) = 0 Then
Criteria = Chr(34) & ctl.ItemData(Itm) & Chr(34)
Else
Criteria = Criteria & " OR " & Chr(34) & ctl.ItemData(Itm) _
& Chr(34)
End If
Next Itm
Me.tboCriteria = Criteria
However, when another form (based on a query with the passed
parameters)opens to show me the selection, there are no data.
The correct String for the query parameter appears to be correct, i.e.,
"item1" OR "item2" and if I replace the same String in the query instead of
using the [Forms]![frmSearch]![tboCriteria] the query works fine.
Where am I going wrong? Any help is appreciated.
Thanks,
I have a form in which several choices are selected, one of which is a list
box in which the user can make multiple selections. I followed the various
suggestions to create a String that has the selected items and I set a
textbox in the form as that final String as follows:
Dim Criteria As String
Dim ctl As Control
Dim Itm As Variant
' Build a list of the selections.
Set ctl = Me![lboSTATID]
For Each Itm In ctl.ItemsSelected
If Len(Criteria) = 0 Then
Criteria = Chr(34) & ctl.ItemData(Itm) & Chr(34)
Else
Criteria = Criteria & " OR " & Chr(34) & ctl.ItemData(Itm) _
& Chr(34)
End If
Next Itm
Me.tboCriteria = Criteria
However, when another form (based on a query with the passed
parameters)opens to show me the selection, there are no data.
The correct String for the query parameter appears to be correct, i.e.,
"item1" OR "item2" and if I replace the same String in the query instead of
using the [Forms]![frmSearch]![tboCriteria] the query works fine.
Where am I going wrong? Any help is appreciated.
Thanks,