A family of Microsoft relational database management systems designed for ease of use.
I can't quite figure out what you are trying to do here. The fact that you include a Boolean AND operator in the sWHERE variable suggests that you might be trying to select multiple EquipmentID values successively, but the code doesn't allow that as (a) the sWHERE variable is declared locally in the function, and is not declared Static, so will be reinitialised to a zero length string at each function call, and (b) the Boolean operator would need to be OR, not AND.
If you are trying to select multiple EquipmentID values, then a much simpler solution would be to use a multi-select list box rather than a combo box, and then filter the form on the basis of the selections, for which the code would be:
Dim ctrl As Control
Dim varItem As Variant
Dim strEquipmentList As String
Set ctrl = Me.lstEquipment
If ctrl.ItemsSelected.Count = 0 Then
' remove filter if no items selected
Me.FilterOn = False
Else
For Each varItem In ctrl.ItemsSelected
strEquipmentList = strEquipmentList & "," & ctrl.ItemData(varItem)
Next varItem
' remove leading comma
strEquipmentList = Mid(strEquipmentList, 2)
' apply filter
Me.Filter = "EquipmentID IN(" & strEquipmentList & ")"
Me.FilterOn = True
End If
This could go either in the list box's AfterUpdate event to progressively filter the form at each selection, or, more efficiently, in a separate button's event procedure.
If, on the other hand, you are, trying to restrict the form's record to one equipment ID then a combo box with the following code in its AfterUpdate event procedure would suffice:
Dim strFilter As String
strFilter = "EquipmentID = " & Me.cboEquipment_ID
If Not IsNull(Me.cboEquipment_ID) Then
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.FilterOn = False
End If