Results 1 to 3 of 3
  1. #1
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100

    how to remove last character if its a letter?

    Hello all, I currently have this expression
    Code:
    IIF([Field1] Like "*Dr*",LEFT([Field2] & [Field3],LEN([Field2] & [Field3]-1),"")
    that removes the last character if field1 contains 'Dr'. It works except some of the data that is in field 3 ends in a letter that wasn't there before when i was conducting my analysis. The length varies so I can't use the mid function. Is it possible to just remove the last character of a field if its a letter and ignore it if its a number?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,961
    Don't see how that expression can work because need paren in front of -1.

    IIf(IsNumeric(Right([Field3],1)), do this, else this)

    IIf([Field1] LIKE "*Dr*", [Field2] & Left([Field3], Len([Field3]) - IIf(IsNumeric(Right([Field3],1)), 1, 0)), "")
    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
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100
    you are amazingly sharp or I'm amazingly dumb - thank you. Your last expression did the trick.

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

Similar Threads

  1. If last character of string comma remove it.
    By Solarlux in forum Access
    Replies: 1
    Last Post: 02-02-2018, 03:09 AM
  2. Replies: 18
    Last Post: 10-11-2017, 03:07 PM
  3. Remove First Character
    By Juan4412 in forum Queries
    Replies: 6
    Last Post: 08-06-2015, 04:49 PM
  4. update/remove character from field
    By Ruegen in forum Queries
    Replies: 6
    Last Post: 01-23-2014, 05:08 PM
  5. Replies: 4
    Last Post: 09-18-2012, 05:07 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