Results 1 to 5 of 5
  1. #1
    tylerpickering is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    22

    Multiselect Form & Query

    Hello,

    I have a multi-select list form and I am wondering if I am able to base a query off of this. (see attached picture)

    My current query is
    Code:
    In ([Forms]![Interface]![EquipmentList])
    but that does not appear to be working.

    Any suggestions? Is this possible with the multi-select list?

    Thanks!



    Click image for larger version. 

Name:	form2.PNG 
Views:	13 
Size:	7.0 KB 
ID:	18685

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    It is much easier to NOT use multiselect lists. Instead use 1 list, dbl-click item to add it to a Find tbl...tFind
    it runs a query to add the value to the table.
    when done, run another query , joined to the tFind, and only those elements will show.

    ZERO VB PROGRAMMING. (just macros)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Really? That doesn't sound easier. I don't use macros, but can't think of what action would add an item to a table. Or do you fire off an append query? You have to handle un-selecting an item too; how do you do that? At some point you have to clear the table; delete query? So an extra table, 2 extra queries and 2-3 macros to replace a few lines of code that can be copy/pasted? I respect your skills ranman, but I don't see this one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    Just a thought before you implement a solution. This isn't a "final" solution but I hope it helps to steer you in the right direction.

    Right now, your picklist and data are setting you up for failure. The variables are not properly normalized.

    If I am understanding your picklist correctly, it looks like you want a query to use OR logic, as in "Return the results where trailer type is equal to Dry Van OR Specialized." Your query would then return all results of all trailers with type of Dry Van, and then all results of all trailers with type of Specialized.

    On the contrary, if you are using AND logic, as in "Return the results where trailer type is equal to Dry Van AND Specialized," then your query would return nothing, because right now Dry Van and Specialized are two different trailer types (as in, a trailer cannot be both Dry Van and Specialized in the database at the same time).

    You must decide whether you want to use: OR, AND. Cannot be both.

    No matter what you pick, you need to separate out the variables into three picklists. You should also separate your data this way as well (if you are controlling the data):

    Trailer Category: Standard, Intermodal, none
    Trailer Type: Bulk, Dry Van, Flatbed (Standard), Specialized, none
    Trailer Temp Controlled: Temp Controlled, none

    OR Logic:
    Standard OR Dry Van OR Temp Controlled, would return all possibilities where the trailer is Standard or Dry Van or Temp Controlled. You could also use the "none" selection if you don't want to consider a particular characteristic. You might get results that you do not want though - such as Temp Controlled would also return Intermodal Temp Controlled, even though you selected a Standard trailer category.

    AND Logic:
    Standard AND Dry Van AND Temp Controlled, would only return the possibilities where all three conditions are met (like a reefer trailer). You could also use the "none" selection if you don't want to consider a particular characteristic.

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

Similar Threads

  1. Replies: 8
    Last Post: 11-11-2013, 08:39 PM
  2. Replies: 1
    Last Post: 08-14-2013, 04:09 PM
  3. Replies: 15
    Last Post: 07-20-2013, 12:42 PM
  4. Replies: 4
    Last Post: 02-14-2013, 09:33 PM
  5. Replies: 8
    Last Post: 09-20-2012, 03:27 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
  •  
Other Forums: Microsoft Office Forums