Results 1 to 4 of 4
  1. #1
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253

    Checking if a character in a string exists at the end of a variable length string and replacing.

    I have a string that should have an * at the end of the string. The string is variable in length. What i am trying to do is make sure that it is an * and then replace it with a ;. I used InStrRev to find if it is there but i am not surer how to replace it after i find it. Any help or advice on where to get examples of what i am trying to do would be great. I have been googling it all morning and have not found anything more than the InStrRev part. Thank you. --Walker

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    8,345
    if right(sText,1) = "*" then replace(sText,"*","a")

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,629
    Only use ";" instead of "a".
    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
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    i couldnt find the replace function for access. I only found it for excel. Thank you.

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

Similar Threads

  1. cannot be a zero-length string
    By MadTom in forum Forms
    Replies: 5
    Last Post: 03-09-2020, 07:52 AM
  2. Field Cannot Be A Zero Length String Error
    By VSCurtis in forum Programming
    Replies: 6
    Last Post: 05-09-2017, 10:52 PM
  3. Replies: 7
    Last Post: 09-23-2016, 01:04 PM
  4. Replacing String Within Form Module
    By kdbailey in forum Access
    Replies: 3
    Last Post: 07-13-2016, 08:14 AM
  5. Replies: 6
    Last Post: 01-21-2014, 06:39 PM

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 - Senior Forums