Hello,
I'm at a loss here.
I have a form with an embedded query that populates a multi-column listbox.
The Listbox is too Simple for Multi Select.
The listbox shows 5 different columns.
Date, Div, Event, Cases, Cube.
I need to be able to take the lines that are selected and pass them to an already written query.
I'm not sure how I'm going to go about this yet, but at the very least I need access to the variables.
The back of my mind is saying that I'm going to dump the results to a temp table, and then use that table to limit the data the query pulls.
The issue I am running into is that any time that I try and pull the results of the field, all I get is the Bound Column column.
I need all columns data, not just 1.
I have tried modifying Microsoft’s example from their help to do this, but either I'm missing something, or this will not do what I want.
Code:
Private Sub testmultiselect_Click()
Dim oItem As Variant
Dim intColumn As Variant
Dim sTemp As String
Dim iCount As Integer
iCount = 0
If Me!NamesList.ItemsSelected.Count <> 0 Then
For Each oItem In Me!NamesList.ItemsSelected
If iCount = 0 Then
sTemp = sTemp & Me!NamesList.ItemData(oItem)
iCount = iCount + 1
Else
sTemp = sTemp & "," & Me!NamesList.ItemData(oItem)
iCount = iCount + 1
End If
Next oItem
Else
MsgBox "Nothing was selected from the list", vbInformation
Exit Sub 'Nothing was selected
End If
Me!mySelections.Value = sTemp
End Sub
Any help or advice would be appreciated.
Jason