Results 1 to 2 of 2
  1. #1
    jdrogers81 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4

    How do I Query based upon whole word value in form text field

    I know how to create a query with a critera operator "Like" that uses a value entered in a form text field. Example:



    Like "*" & [Forms]![formName]![txtValue] & "*"

    This query criteria searches the entire field for the data entered into the text box on a form. The problem is it returns records where the value entered is part of a word. I only want records that contain the whole word as entered on the form. The field I am querying has multiple words, so I need it to find one WHOLE word in the field as entered in the query.

    Current Example: "car" returns"carpal", "carnage", etc.

    Desired Example: "car" returns only "car"

    Please help!

  2. #2
    jdrogers81 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4
    Thanks to Bob G on UtterAcess Forums for the quick answer!

    Bob G wrote:

    you would need to include the space before and after. This is untested.

    Like "*"& " " & [Forms]![formName]![txtValue] & " " & "*"

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

Similar Threads

  1. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM
  2. OLE and Text Field with MS Word
    By WBlohm in forum Programming
    Replies: 0
    Last Post: 09-09-2010, 12:56 PM
  3. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  4. Replies: 0
    Last Post: 03-15-2010, 01:53 PM
  5. Replies: 1
    Last Post: 11-10-2009, 03:20 PM

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