Results 1 to 3 of 3

Filter query through a multiple choice list box

  1. #1
    crimson is offline Novice
    Windows 7 Access 2013 32bit
    Join Date
    Nov 2010
    Posts
    11

    Filter query through a multiple choice list box

    Hi,
    I have a form with a list box. The list box is set for simple multiple choices. Entries for the list box are taken from a table. Each record in the table has a unique text column (name of the sample) and corresponding ID. The list box shows only the text column. A query summarizes results of calculations, which are based on the data from the table. I would like to be able to filter the query based on the list box. E.g., when a user marks five entries in the list box and clicks a button the query should popup, filtered only to records marked in the list box. How to achieve that?

    Thank you in advance
    Regards

  2. #2
    ridders52's Avatar
    ridders52 is offline Voodoo Is Practised
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    2,716
    You've just about described it already

    Add code to the button click event to run a query or SQL equivalent
    In your query / SQL, set filter criteria for the field in your listbox and set it to Forms!YourFormName!Form.ComboBoxName

    That will get the bound column - which is usually hidden.
    Columns are zero based so if your text field is the 3rd column use Forms!YourFormName!Form.ComboBoxName.Column(2)

    Replace form and combo names with your own
    Colin (Mendip Data Systems), Website, email
    If this has helped, please click the star button and leave a comment

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    45,583
    If you want to filter for the 5 selected items, this requires code that loops through the listbox selection. Review http://allenbrowne.com/ser-50.html
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Making a multiple choice list searchable
    By dwheatley in forum Queries
    Replies: 8
    Last Post: 12-13-2017, 02:41 AM
  2. Replies: 7
    Last Post: 09-14-2017, 01:24 AM
  3. Replies: 0
    Last Post: 03-19-2017, 12:29 PM
  4. Replies: 1
    Last Post: 03-03-2016, 04:23 PM
  5. Replies: 5
    Last Post: 04-11-2012, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums