Results 1 to 4 of 4
  1. #1
    MarksinMO is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    13

    LIKE query does not give desired results

    I have a form to select records defined by criteria in a "search" query. I used the simple query wizard since this looked "simple" !! ... I get results just not the desired results. Example: Field Name "Description" if I search for Green ... I will get Green Light, Green Lens, Green Bulb ... but do not get Lighted Green, Lamp Green, Simple Green. Basically if the description STARTS with the Criteria it will find it ... but will not find it if buried in the description. The code I used is as follows on the query design ... Field: Description Table: tblPartsDatabase Criteria: Like [Forms]![Part Search]![Description] & "*" Thanks in advance

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Like "*" & [Forms]![Part Search]![Description] & "*"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Use Google or Bing to do some research.

    I'm not sure where you found
    Code:
    Like [Forms]![Part Search]![Description] & "*"
    but right beside it you should have seen
    Code:
    Like "*" & [Forms]![Part Search]![Description]
    and
    Code:
    Like "*" & [Forms]![Part Search]![Description]&"*"
    These each have different meanings, and each is important.

    Code:
    Find things                    Syntax
     Starting with  "j" ------- Like "j" & "*"
    Ending with    "j"-------- Like "*" & "j"
    Containing      "j"-------- Like "*" & "j" & "*"

  4. #4
    MarksinMO is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    13
    June7 I did try that but it still did not work ... However I closed Access then reopened and for whatever reason it started working correctly and continues with no issues. Thanks. Orange - I am relatively new to access, SQL and coding and constantly hammer google and the internet for advice and I did see the code June7 added. I continue to learn through the assistance of the internet and sites like this ... thanks.

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

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2014, 03:47 AM
  2. Replies: 7
    Last Post: 10-03-2014, 05:50 PM
  3. Replies: 11
    Last Post: 11-01-2013, 09:49 AM
  4. Sum results give me negative values !
    By Costa in forum Reports
    Replies: 4
    Last Post: 03-03-2010, 12:58 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