Results 1 to 5 of 5
  1. #1
    CGBJR is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    3

    Incomplete records returned - too many "like" criteria?

    I have a small table (about 8000 records) linked to an even smaller table (1200 records). I'm building a query that I want to have prompted "like" criteria in four text fields. The problem is that when I use three "likes", I get all the proper records, but when I add the fourth, I get fewer records.

    This happens no matter what criteria I enter in any or all prompts, or even if I enter criteria for only one prompt. I thought my syntax in the criteria might be bad, so I made the fourth criteria a non-prompted one: like "*" Even that gave me incomplete results.



    Is there a limit on the number of criteria I can use? I've compacted and repaired the db, and made sure there are no field names with spaces in them. I'm stumped.

    Access 2010, Windows 7 64 bit home edition.

    Thanks in advance - Chuck B

  2. #2
    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,848
    Please post the SQL of your query.

  3. #3
    CGBJR is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    3
    Quote Originally Posted by orange View Post
    Please post the SQL of your query.
    I did not generate this SQL directly (just filled in the query in design mode) but here it is:

    SELECT DISTINCTROW CD_TRACKS.ShelfNum, COMPOSER.Lastname, CD_TRACKS.Performer, CD_TRACKS.Original_Title, CD_TRACKS.English_Title, CD_TRACKS.Date_of_Composition, CD_TRACKS.TrackNum, CD_TRACKS.Duration_of_Work, CD_TRACKS.Conductor, CD_TRACKS.Genre, CD_TRACKS.Composer_Add, CD_TRACKS.[New ID], CD_TRACKS.Composer_New
    FROM CD_TRACKS INNER JOIN COMPOSER ON CD_TRACKS.Composer_New = COMPOSER.[Composer#]
    WHERE (((CD_TRACKS.ShelfNum)>1) AND ((COMPOSER.Lastname) Like "*" & [All of Part of the composer's last name:] & "*") AND ((CD_TRACKS.Performer) Like "*" & [AOP of PERFORMER NAME: ] & "*") AND ((CD_TRACKS.Original_Title) Like "*" & [AOP of Title in Original Language:] & "*") AND ((CD_TRACKS.Composer_New) Is Not Null))
    ORDER BY CD_TRACKS.ShelfNum;

  4. #4
    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,848
    I don't think you are reaching a limit on the number of LIKES.
    You are ANDing all of your criteria so you are getting a narrower and narrower set of data.
    Also you are using LIKE *sometext* which means these characters in any part of the field value.

    You could try Like sometext* where you know characters at the start of the field.

    Can you finnnd a few examples of records that would meet all of your criteria, or set up some tests; then add more LIKEs to see if there are no records matching all of your criteria; or prove it is something to do with the number of LIKES.

  5. #5
    CGBJR is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    3
    As far as I can tell, adding the like "*" language chooses everything in that column. Am I wrong? My point is, no matter what the 4th "like" is, I get incomplete data. 47 records without the like "*", 33 with it. Now if instead of the like command I use something like >"a" as the 4th selector I get all the records. It's just the like command that messes things up.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-17-2013, 08:27 AM
  2. Replies: 7
    Last Post: 08-14-2013, 03:57 PM
  3. Replies: 5
    Last Post: 06-19-2012, 03:16 AM
  4. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  5. Passing criteria "NULL" or "IS NOT NULL" to a query
    By SgtSaunders69 in forum Forms
    Replies: 1
    Last Post: 12-24-2011, 02:22 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