Add a button to the form with code along these lines in its Click event
procedure. For this example I've assumed the list box, lstEmployees, is of
employees and the list box's bound column is a numeric EmployeeID:
Dim varItem As Variant
Dim strEmployeeIDList As String
Dim strCriteria As String
Dim ctrl As Control
Set ctrl = Me.lstEmployees
If ctrl.ItemsSelected.Count > 0 Then
For Each varItem In ctrl.ItemsSelected
strEmployeeIDList = strEmployeeIDList & "," &
ctrl.ItemData(varItem)
Next varItem
' remove leading comma
strEmployeeIDList = Mid(strEmployeeIDList, 2)
strCriteria = "[EmployeeID] In(" & strEmployeeIDList & ")"
DoCmd.OpenForm "frmMain", WhereCondition:=strCriteria
Else
MsgBox "No Employees Selected", vbInformation, "Warning"
End If
Ken Sheridan
Stafford, England
> Hi
> I’ve got search form (frmsearch) with a list box with several columns and
> which has its Multi Select property set to “Extended”. Is there a way the
> user can select multiple rows from the list box and have it return the
> resulting records to another form (frmMain)?