Results 1 to 6 of 6
  1. #1
    NeilT23 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    3

    Need Query to locate specific text within a database


    Trying to build a query that will Identify the last two characters within a text field. I need to search that field for any listing that ends with an _L or _F. I have tried the RIGHT Formula (Right("_L",2), but it is not working. I may be missing a wild card or may not have the query stated properly.

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    In the criteria, you only need "*_L" or "*_F". The formula "Right" is not needed.
    If it is not working, please post your SQL.

  3. #3
    NeilT23 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    3
    The reason I was trying to use the right formula is to avoid other locations where the _L or _F may be present in the text field. In other words I can have TN_LVL_HILLS_S. In this example I would pick up this item because the field contains an _L so the '*_L* will not work. The _L I am looking for is at the end of each text string but for some reason the RIGHT formula is not picking that portion of the text string..

  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,738
    This will test the rightmost 2 characters in field yourFieldName to be "_L"
    Right(yourFieldName,2) ="_L"

    But where exactly are you using this? In a query expression? vba code?

    When you need to see an example of an Access function and its proper syntax, go to
    www.techonthenet.com

    Try http://www.techonthenet.com/access/f...ring/right.php

  5. #5
    NeilT23 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    3
    Thank you!!! Thank You!!! That did it... I forgot to add the FieldName to the formula... Thank you again!!!

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    For your future reference:

    The wildcard "*" have to work with "LIKE".

    The wildcard "*_F" will match anything that end with "_F".
    The wildcard "*_L" will match anything that end with "_L".

    The wildcard "*_F*" will match anything that have "_F" within the text string.
    The wildcard "*_L*" will match anything that have "_L" within the text string.

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. Replies: 8
    Last Post: 04-14-2014, 07:26 AM
  3. Replies: 12
    Last Post: 02-25-2014, 08:32 AM
  4. Replies: 7
    Last Post: 06-06-2013, 10:32 AM
  5. Replies: 11
    Last Post: 11-12-2012, 06:33 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