Results 1 to 9 of 9
  1. #1
    justifiedcandy is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    6

    Query does not yield results


    I am trying to create a query that will display results based on the contents of a cell. I am using the "contains" function (Like [----] & *"*) to prompt the user on what he would like to search. My chart contains the value "lightly roasted chicken" under the column "meat." When I try and search by chicken, no results show. What am I doing wrong?
    Thanks

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I think you want for criteria: Like [----] & "*" versus Like [----] & *"* (notice the "*")

  3. #3
    justifiedcandy is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    6
    my bad typo in the access document i did it in the correct format ("*"). Still no results.

  4. #4
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,173
    Hi,

    As chicken is the last word, you'll need another wildcart in front:

    like "*" & [.....] & "*"

    hgreeting
    NG

  5. #5
    justifiedcandy is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    6
    thanks, but what if "chicken" or the object the user is searching for is is several locations in the cells? i.e.

    cell 1:
    roasted chicken and beans

    cell 2:
    lemon chicken

    cell 3:
    chicken with steamed vegetables

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    *xxxx* is for any occur place including following cases:

    roasted chicken and beans
    lemon chicken
    chicken with steamed vegetables
    abcchicken other words
    chickennnnnn

    But not including: xxx chick en xxx

  7. #7
    justifiedcandy is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    6
    thanks, works now.
    is there a way to provide the user with search parameters rather than the user typing it in himself? i.e. rather than the user typing "chicken", he could refer to a list of options.

  8. #8
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I would create a table (ie. lookup table) and put the values in that table. Then design a combobox on the form with the rowsource of the combobox based on this lookup type table.

    Then you could base your criteria off the value of the combobox on the form.

    ie.

    Like Forms!MyFormName!MyComboboxName & *
    or
    Like * & Forms!MyFormName!MyComboboxName & *

    There are many search type/query criteria examples in the code repository if you'd like to see different examples of how this is done.

  9. #9
    oldman is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Posts
    17
    That is a great solution pkstormy.
    It sets things up to make the user use the right words for the search while letting them choose the word they most would like to associate with the resulting query. The only problem I can see with it is the person who only wants fried chicken and does not want to see the results of roasted chicken. Those few people will be disappointed with the results. Yes, I write such meaningless queries as a regular part of my job and have experienced just such comments.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  2. cbo to filter results from a query
    By nianko in forum Forms
    Replies: 5
    Last Post: 08-18-2010, 09:43 AM
  3. Email Query Results
    By eddie_keating in forum Queries
    Replies: 1
    Last Post: 06-16-2010, 11:09 AM
  4. Query not returning all of the results
    By velvettiger in forum Queries
    Replies: 4
    Last Post: 03-11-2010, 06:56 AM
  5. Query results order
    By Costa in forum Queries
    Replies: 6
    Last Post: 02-24-2010, 06:07 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