Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Location
    Australia
    Posts
    23

    Unanswered: Can i search a memo field for two user defined terms and return query results?

    Hi all,

    I have created a database where i can search a field based on a user entered parameter in a query.

    For the basis of this example, it is a memo field called Ingredients
    In the query criteria i have used:
    Code:
    Like "*" & [Enter Search Term] & "*"
    This works fine, i click a button to open the query, it asks Enter Search Term, i enter a term and it gives results. Thats fine.

    What i want though is to search multiple terms within the one memo field.

    In other words, prompt to enter a search term twice and bring back results if both search terms are found.

    I tried
    Code:
    Like "*" & [Enter Search Term] & [Enter Second Search Term]
    but i think its combining the two terms and not searching for each on its own.

    I am sure there is someway i can do it, can anyone help?

    Thanks
    You can use statistics to prove anything - 78% of people know that!

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,422
    Provided Answers: 8
    Like "*" & [Enter Search Term] &"*"& [Enter Second Search Term] & "*"
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Aug 2004
    Location
    Cary, NC
    Posts
    264
    Quote Originally Posted by myle View Post
    Like "*" & [Enter Search Term] &"*"& [Enter Second Search Term] & "*"
    This is only going to return results if both search terms are in the field in the order they are entered. If you want to return both terms in either order then you would need to use this instead

    Code:
    Like "*" & [Enter Search Term] & "*" And Like "*" & [Enter Second Search Term] & "*"
    However, it doesn't stop the user from only entering one search term. A blank search term will just return everything that matches the other search term.
    Last edited by sps; 07-16-12 at 15:55. Reason: forgot something

    Steve

  4. #4
    Join Date
    May 2012
    Location
    Australia
    Posts
    23
    ok, thanks i will give it a go :-)

    I hadnt thought about using 'And' in the criteria parameters
    You can use statistics to prove anything - 78% of people know that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •