L
Lee Harwell
The following code is my failed attempt to get the items picked in a
multi-select List box to then appear in another form named "NameDetailForm".
The NameDetailForm does open but does not show the items picked from the
list box. I believe the end part of my code is flawed, but cannot figure
out what it should correctly be. If there is better code for this purpose, I
would appreciate seeing it.
Private Sub Itemschosen_Click()
Dim strWhere As String, varItem As Variant
If Me!NameListBox.ItemsSelected.Count = 0 Then Exit Sub
For Each varItem In Me!NameListBox.ItemsSelected
strWhere = strWhere & Me!NameListBox.Column(0, varItem) & "'"
Next varItem
strWhere = Left$(strWhere, Len(strWhere) - 1)
strWhere = "[ComputerNo] IN (" & strWhere & ") "
DoCmd.OpenForm "NameDetailForm"
DoCmd.Close acForm, Me.Name
End Sub
multi-select List box to then appear in another form named "NameDetailForm".
The NameDetailForm does open but does not show the items picked from the
list box. I believe the end part of my code is flawed, but cannot figure
out what it should correctly be. If there is better code for this purpose, I
would appreciate seeing it.
Private Sub Itemschosen_Click()
Dim strWhere As String, varItem As Variant
If Me!NameListBox.ItemsSelected.Count = 0 Then Exit Sub
For Each varItem In Me!NameListBox.ItemsSelected
strWhere = strWhere & Me!NameListBox.Column(0, varItem) & "'"
Next varItem
strWhere = Left$(strWhere, Len(strWhere) - 1)
strWhere = "[ComputerNo] IN (" & strWhere & ") "
DoCmd.OpenForm "NameDetailForm"
DoCmd.Close acForm, Me.Name
End Sub