Results 1 to 7 of 7
  1. #1
    alecf720 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    3

    Access 2013 - creating a multiple select listbox - please help!

    Hi,

    I’m trying to create a bibliographic database with MS Access 2013. Please bear with me as I'm a newbie to this...





    I have created a search query form that uses three list boxes with multiple (extended) select. Basically, users should be able to search for articles by year (1991-2013), country, and keyword (i.e. politics, economy). Without multiple select, the search query works fine, i.e. just clicking one option from each listbox. But now if I click for example 1991 + 1992 and two countries, it returns no records.


    Is this an issue of entering the correct criteria in the query design ( for example, [Forms]![Search Form 0902]![Year].[MultiSelect]) or am I getting into the realms of complex
    programming?



    Would really appreciate any help!

    Alec

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Can you show us your database tables and relationships (jpg)?
    You may be or may not be in the realm of complex programming. We don't know enough about you or your environment, or the business issue/problem or opportunity you are trying to solve. Please tell us more.

    Is this a new database, or one converted from earlier Access or other?

    It would help if we were a little more familiar with your situation.

    Good luck with your project.

  3. #3
    alecf720 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    3
    Hi Orange,

    Thanks for your reply! It is a new database - I only have Access 2013.

    I've attached 3 JPEGS below - I hope they clarify a bit what I am doing. Basically, I'm creating a catalogue of journal articles that users can search by year, country, and keyword - so there are 3 listboxes. I can get it to work if only one option from each listbox is selected, i.e. 2008, Kazakhstan, Politics - it will return all the records that match all three selections. However, I can't get it to work with multiselect - for example, the user wants to find all records from 2006-2012 that concern two countries. I can set up multiselect on the search query form but it doesn't return any records when I press "run query".

    In the design view I can set the criteria [Forms]![Search Q]![Year].[MultiSelect] - but it doesn't work - I've also tried other combinations.

    Am I setting the wrong criteria and that's why it won't work, or is it a case of more complex coding to get this to work?

    Thanks!!

    Attachment 11189 Click image for larger version. 

Name:	Query.jpg 
Views:	15 
Size:	94.7 KB 
ID:	11190 Click image for larger version. 

Name:	Record Table.jpg 
Views:	16 
Size:	120.1 KB 
ID:	11191

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    I don't have acc2013.
    Can you show the SQL of the query for using multiple listbox values?

    Or post a copy of your database in 2010 format.

  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,640
    I think you are into VBA. Here's a method for one listbox:

    http://www.baldyweb.com/multiselect.htm

    In your case you'd build 3 strings to end up with:

    Field1 In(...) AND Field2 In(...) And Field3 In(...)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    alecf720 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    3
    Hi guys,

    Thanks for your responses - really appreciate it.

    I guess there is something with the strings I'm getting wrong. I did get an earlier version to work NOT using multi-select (the strings you see here are from that earlier version, but don't work now since I've been messing about with the mutli-select).

    I'm going to attach a copy of the database here. It would be great if you could have a quick look and see if there is a quick fix or not.

    Thanks very much!

    Alec

    test database 1902.mdb

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Well, the code is incomplete, and is out in the middle of nowhere. It has to be a sub or function. In your case, it would typically be behind the button:

    http://www.baldyweb.com/FirstVBA.htm
    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. “PivotCharts” in the Access 2013
    By jamal numan in forum Access
    Replies: 6
    Last Post: 02-16-2013, 04:06 PM
  2. Replies: 4
    Last Post: 09-17-2012, 10:36 AM
  3. multi select listbox
    By crowegreg in forum Forms
    Replies: 3
    Last Post: 07-28-2012, 01:48 PM
  4. Replies: 3
    Last Post: 06-22-2011, 08:51 AM
  5. select multiple checkboxes in access 2003?
    By GoneFusion in forum Forms
    Replies: 2
    Last Post: 09-20-2010, 01:44 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