Results 1 to 6 of 6
  1. #1
    KevinMS is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    3

    Microsoft Access Form To Query for Multi Value Field

    I am trying to write an Microsoft Access query from a form with a multi value field being the criteria. The field I am trying to use is called Population and the field is represented in my database as a List Box that allows multiple values and it is in the Building table. The values it allows are "Singles";"Familes";"Families with Children";"Youth/Young Adults";"Veterans";. The form that I am creating is called HousingSearch.

    I am trying to create a form which uses this field, so someone could use the list box and check off the values they want and click on the button which would open a query. I know having done this with single value fields the criteria in the query looks something like



    [forms]![HousingSearch]![Building]![Population]

    but if you try the same thing for a multi value field nothing is returned for the query. Any help would be appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Are you saving the actual descriptive text or an ID value for the population types?

    Review: http://office.microsoft.com/en-us/ac...297.aspx#BM4.6

    If you want to search for multiple values in a single field, will require code that builds a criteria string from items selected in UNBOUND listbox. Review: http://www.allenbrowne.com/ser-50.html
    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
    KevinMS is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    3
    I am saving the actual text value.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    From what I understand of multi-value fields, will have to build query that expands the multi-value field to individual records (first link) then use code to build the filter string (second link) as criteria to filter the expanded query.

    Bing: filter multi-value field
    Another reference http://www.access-programmers.co.uk/...d.php?t=199778

    I NEVER use multi-value fields.
    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.

  5. #5
    KevinMS is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    3
    I don't believe I will use a multi-value field again and I am going to change this database to use junction tables instead. Seems like this isn't worth the headache. Thank you for your help

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That will make the true structure of the data transparent but won't eliminate the issue of multiple parameters on one field.
    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: 5
    Last Post: 05-04-2019, 09:02 PM
  2. Multi-user Password in Microsoft Access 2007
    By JunJin,Pooi in forum SQL Server
    Replies: 2
    Last Post: 08-21-2013, 10:06 PM
  3. Multi Field Query
    By dsthome in forum Queries
    Replies: 10
    Last Post: 03-21-2013, 09:21 PM
  4. Replies: 1
    Last Post: 09-13-2011, 01:52 PM
  5. Replies: 1
    Last Post: 12-16-2010, 10:32 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