Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Posts
    8

    Unanswered: Character String

    I am looking for clues on how to run a character string search using a parameter query. As it stands for each field on a form I have the following criteria:

    SELECT table.example
    FROM table
    WHERE (((table.example) Like [Forms]![query]![field] & "*"));

    This returns only those strings that have the wildcard as the first character of the string. For example if the user inputs "a" into the form field that will return all strings that "start" with the letter a.

    What I want to do is return ALL strings that "contain" the letter "a"

    So if 5 fields contain the words: and, atom, bath, rain, lama
    it will return all five words not just "and" and "atom"

    Hope this is clear enough. Thanks in advance.
    Edit/Delete Message

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Try

    Code:
    SELECT table.example
    FROM table
    WHERE (((table.example) Like [Forms]![query]![field] & "*a*"));
    Sam

  3. #3
    Join Date
    Nov 2005
    Posts
    113
    Try to have * on the both side like this:

    SELECT table.example
    FROM table
    WHERE (((table.example) Like '*" & [Forms]![query]![field] & "*'));"

  4. #4
    Join Date
    Feb 2002
    Posts
    8

    Thanks Julita

    Quote Originally Posted by Julita
    Try to have * on the both side like this:

    SELECT table.example
    FROM table
    WHERE (((table.example) Like '*" & [Forms]![query]![field] & "*'));"

    The above worked....thanks a bunch

Posting Permissions

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