Results 1 to 12 of 12
  1. #1
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25

    Query: Pulling out all Records That Contain Specific Text

    In the Owner Name field, I am looking for a way to pull out all estates. They are abbreviated with "EST" or "Estate". The problem is throughout the database, if you do a simple filter for "contains est" it will include names such as "Forester" or "LHB Investments".

    How do I query, or filter this database such that it only returns the estates abbreviated with "EST" or "Estate"? Please see the image below that clearly illustrates this problem.





    Thanks in advance.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Include the leading space " " in your filter. " EST" OR " ESTATE"

  3. #3
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    @RuralGuy, Thank you. Is there a way to save out your filter results to a query to make permanent? Or do you just have to export the database with the filter applied and reimport it?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You can make a static query that just pulls these records. In design view of the table enter the criteria discussed and include this field twice in the design putting your 2nd criteria on a different criteria line which will make it an OR. If they are on the same line it would be an AND.

  5. #5
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    @RuralGuy, Regarding your orignal suggestion for the filter. I attempted that, the problem is it is only returning the "est" estates. It is not returning any record with the word "estate" in it. What did I do incorrectly?


  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I thought you were going to do a static query?

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    The filter wizard has limitations as you've discovered.

  8. #8
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    Quote Originally Posted by RuralGuy View Post
    I thought you were going to do a static query?
    Yes, I am attempting to. Is this what you meant by having the field twice? Also for the criteria how do I enter it in? When using a filter you simply use Contains EST or Estate. You cant type "Contains EST" into the query criteria it gives you an error.



  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Try = " EST" ... and = " Estate"
    Note: it is *not* case sensitive.

    Actually I just realized that won't work. We'll need to use InStr()

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Create another column with the field defined as InStr([Owner_Name]," Est") and a Criteria of >0.
    Create yet another column with the field defined as InStr([Owner_Name]," Estate") and a Criteria of >0.
    I tested this and it works.

  11. #11
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    @RuralGuy

    Perhaps I did something incorrectly, but it is not returning all the "Est" and "Estates" within the database. It is returning some of them. Furthermore these results have made it apparent I need to filter to remove the word "real estate".

    In the output shown below, as I mentioned, most if not all of the "Est" estates have been removed. For example Bill, Johnson Est or Jackie, Thompson Est.


  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Show me what you have in the Field row of those two columns please. It does not show completely in the picture. You should be able to use a Not InStr() function to eliminate the "Real Estate" rows.

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

Similar Threads

  1. Query Out Specific Text
    By ysabella in forum Queries
    Replies: 1
    Last Post: 11-19-2015, 03:53 AM
  2. Query not pulling all records
    By noretoc in forum Queries
    Replies: 2
    Last Post: 01-11-2012, 12:37 PM
  3. Query to show only specific records
    By CEV in forum Queries
    Replies: 5
    Last Post: 03-30-2011, 09:42 AM
  4. Query-for specific records?
    By sirnickettynox in forum Queries
    Replies: 6
    Last Post: 03-30-2011, 03:11 AM
  5. Pulling Specific Data from Excel
    By DICKBUTTONS in forum Access
    Replies: 1
    Last Post: 11-19-2010, 11:23 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