Results 1 to 4 of 4
  1. #1
    Sailor is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2014
    Posts
    5

    Query criteria based on multi select list box?

    Hello All,



    I have found many valuable resources here and finally need to post my question. I'm a newbie, but making my way slowly.

    I have an unbound form, with a series of unbound combo boxes. These provide the criteria to a query, which is displayed in the sub-form. I use command button to requery the sub-form with the items selected in each combobox.

    The one thing I need though, is to have multiple selections from a list box on the form, to be passed to the same query, to further filter the results. In searching, I saw that this needs to be done through VBA somehow. Unfortunately this is beyond my ability. Could anyone suggest how to accomplish this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Sailor is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2014
    Posts
    5
    Quote Originally Posted by June7 View Post
    Thank you for this reference. That does seem fairly straight forward...only one maybe silly question. The command button already has a macro assigned to it to requery the sub-form (based on all the combobox options). Can I have the macro, AND the VBA happen when the button is clicked?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Macros can call VBA functions (not subs).

    Are you using a dynamic parameterized query as the form RecordSource? I've never used that approach to filter form.

    I suppose dynamic parameterized query and code to set Filter property will work together. Never tried.

    I also don't use macros, only VBA.

    I use VBA to construct filter criteria. Review the link at the very bottom of Allen's tutorial.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 14
    Last Post: 02-19-2013, 03:16 PM
  2. Replies: 1
    Last Post: 02-12-2013, 10:41 AM
  3. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  4. Multi-Select List Box as Criteria in Query
    By broadwat in forum Queries
    Replies: 6
    Last Post: 09-19-2011, 07:47 AM
  5. Replies: 1
    Last Post: 03-01-2009, 09:53 AM

Posting Permissions

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