Share via

Using List Box to Filter Form

Anonymous
2017-11-07T13:43:02+00:00

I previously asked how to filter a form using combo box and that worked great. I am now trying to do the same with a list box.

I have about ten values in the list box (different systems of an airplane)

The form has information about individual parts of an airplane. One of the boxes in the form is what system that part belongs to (example: the rudder belongs to the tail "system")

I want to be able to click on tail in my list box and only the parts belonging in this system show up/ are filtered.

Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2017-11-07T17:04:24+00:00

    Code of exactly the same character will work just the same in a list box's AfterUpdate event procedure.  Apart from a multi-select list box, which, from your description, is not the case here, a list box and a combo box behave in a nearly identical manner.  The difference is more one of appearance than functionality.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2017-11-07T16:32:45+00:00

    This is my code for one of the combo boxes: 

    Private Sub ComboBox_AfterUpdate()

    Dim strCriteria As String

    strCriteria = "SystemName= """ & Me.ComboBox & """"

    DoCmd.OpenForm "Airplane_Form", WhereCondition:=strCriteria

    I'm fairly new to coding so I know that the code doesn't translate the same to list boxes. What do I need to change so that my code works and my forms show up filtered?

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2017-11-07T15:59:26+00:00

    To filter a form by a single selection in a list box whose MultiSelect property is False, which is the default, is exactly the same as filtering by means of a combo box.  Where the MultiSelect property is True, to filter by one or more selected items requires code which loops through the control's ItemsSelected collection.

    Was this answer helpful?

    0 comments No comments