Results 1 to 5 of 5
  1. #1
    frons's Avatar
    frons is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Apr 2015
    Location
    Belgium
    Posts
    17

    Question List box not parsing multiple results

    Hello, this is the issue I'm trying to fix. Hope to get some help.



    I got 3 objects:
    1. a form (frm_Scelta) with a combo box (cmbTurno), a list box (lstGL) and a button (btnInvia) that opens the report.
    2. a query (Qry_Rpt) whose criteria have been selected in frm_Scelta, to populate the report.
    3. the above mentioned report (rptStudenti), populated by the query Qry_Rpt.

    Theoretically the form (which is a combo box and a list box) should pass their data the query as its criteria in order to populate then the report, problem is nothing get parsed.
    Funny thing is that if I set the list box Multi Select property to None ( to work like another combo box) it seems to work: the report is opened and correctly filled with data.

    I know that there's no way to use a multi-select list box without using code.I'd need to create the Where clause by looping through the selected items, and dynamically recreate the query, which I'm not able to do.

    What am I missing?
    Last edited by frons; 04-26-2018 at 04:15 AM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    dont use multi select to run a query/report.
    instead, use a 'picked' table. Dbl-click the items in the list to add to the tPicked table.
    join the tPicked table to the query and only those items will get pulled.

    Click image for larger version. 

Name:	pick state-lbl.png 
Views:	18 
Size:	34.2 KB 
ID:	33743

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Here's a way to use the listbox:

    http://www.baldyweb.com/multiselect.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    frons's Avatar
    frons is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Apr 2015
    Location
    Belgium
    Posts
    17
    Quote Originally Posted by pbaldy View Post
    Here's a way to use the listbox:

    http://www.baldyweb.com/multiselect.htm
    I have checked it and I have a couple of questions:
    1. Where should I place this code, on the send button in the form?
    2. How should I implement it in order to parse, not only the string from the list box, but at the same time the value selected in the combo box? Both of the sources have to be taken into account, not only the list box's

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The code would go behind the button opening the report. Simplest for you might be leaving the combo criteria in the query and applying the listbox criteria in VBA.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 09-01-2015, 11:22 AM
  2. Replies: 1
    Last Post: 08-13-2015, 08:02 AM
  3. Parsing Data Into Multiple Fields
    By JeffGeorge in forum Access
    Replies: 3
    Last Post: 07-25-2013, 10:11 AM
  4. Replies: 7
    Last Post: 07-11-2013, 10:05 AM
  5. Replies: 7
    Last Post: 06-20-2013, 12:09 PM

Tags for this Thread

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