Results 1 to 5 of 5
  1. #1
    SSgtBarry is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Yuma, AZ
    Posts
    17

    How do I return last character in a string?


    I have a field named "Document Number". It contains document numbers of various lengths/sizes, originating from various companies. I need to search for document numbers that might be the same, except they may have a suffix (last letter) that makes them different. Is there a way I can find these? Can I build a query that will show / cut off the last letter of a string?

    Thanks in advance!

  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,847
    Right(Trim(YourFieldName),1) will give the rightmost non-blank character

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,600
    Is the last character the only possible alpha? Can test if the entire value will evaluate as a number.

    SELECT * FROM tablename WHERE Not IsNumeric(YourFieldName);

    Or maybe you want to return all records with the same prefix part, disregarding the last character.

    SELECT * FROM tablename WHERE [Document Number] LIKE [enter prefix part] & "*";
    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.

  4. #4
    SSgtBarry is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Yuma, AZ
    Posts
    17
    Thanks for the help! The Document Number could end in either a alpha character or numeric. No specific length.

  5. #5
    SSgtBarry is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Yuma, AZ
    Posts
    17
    @ Orange.... Thanks! I believe that does it!

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

Similar Threads

  1. Return text after a string
    By Madmartigan in forum Queries
    Replies: 11
    Last Post: 03-04-2014, 03:20 PM
  2. Replies: 6
    Last Post: 01-21-2014, 06:39 PM
  3. Replies: 6
    Last Post: 06-07-2013, 09:45 AM
  4. Replies: 1
    Last Post: 02-08-2012, 04:44 PM
  5. Line Return escape character
    By Jerry8989 in forum Access
    Replies: 8
    Last Post: 10-02-2009, 09:53 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