Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2004
    Posts
    5

    Unanswered: Any part of field" match

    How can I make my search button have the "Any part of field" match as a default? with a simple query...


    I have a field in MS access with hundreds of words (cv)... I want to be able to find a word in "Any part of field"

    my try:

    WHERE ((([cv].[detail cv])=[detail]));

    detail is nowhere to find... i am prompt to give a value. fine.but it
    equals whole field; detail must be the sole value of the field detail cv...


    help!

    mchel

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    If you are patient enough to wait for the results, try using the LIKE clause.

    -PatP

  3. #3
    Join Date
    Jun 2004
    Posts
    5
    what do you mean ? I dont know in advance what is the value ...

    do you have an example ?

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    See MSDN.

    -PatP

  5. #5
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    Try

    Code:
    WHERE [cv].[detail cv]) LIKE '%whatever_word_you_want%'
    but as Pat said, prepare for a long wait if there are many records. Full Text Indexing is another option although I haven't used it much. It's much faster than the above method when doing frequent searches.

  6. #6
    Join Date
    Mar 2003
    Location
    Bucharest, Romania
    Posts
    80
    This is the SQLServer forum, not de Acces (bleah...) forum, but anyway:

    select ... from ... where [Field] like '*' & trim([ParamName]) & '*'.

    PS
    In SqlServer '%' is the wildcard for anything, but in Access is '*'. Why the hell Bill considered to use different chars for wildcards in every SGBD that he owns, I don't really know.
    ionut
    Who cares about Romanian football ???

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what is SGBD?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    Access 97 did use the asterisk (*) as it's wildcard character. Uncle Bill changed this in Access 2002 and it now is the percent sign (%). This was not well documented but welcome all the same.

    To clarify a bit more, the change occurred in the switch from JET 3.5 to JET 4.0, not really in Access, which is just a GUI into JET like Enterprise Manager is to SQL Server.
    Last edited by grahamt; 06-11-04 at 08:43. Reason: clarification

Posting Permissions

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