Remove only the last comma

Discussion in 'Access General' started by Garry, Apr 24, 2013.

  1. Garry

    Garry Guest

    Hi

    I need to remove or replace with "" only the last comma in a field

    from: Bill, John, Matt, Fred,

    to : Bill, John, Matt, Fred

    Any help would be appreciated, have tried Replace([Field],"*,","") but no
    good

    Cheers
     
    Garry, Apr 24, 2013
    #1
    1. Advertisements

  2. Garry

    Puppet_Sock Guest

    You might find the function InStrRev() helpful.
    In combination with the functions Len(), Left(),
    and Right(), you may be able to do what you need.
    Socks
     
    Puppet_Sock, Apr 24, 2013
    #2
    1. Advertisements

  3. Replace doesn't recognize wildcards, only literal text.

    I'd suggest updating the field to

    Left([fieldname], Len([fieldname]) - 1)

    where [fieldname] LIKE "*,"

    since the LIKE operator does use wildcards.
    --

    John W. Vinson [MVP]
    Microsoft's replacements for these newsgroups:
    http://social.msdn.microsoft.com/Forums/en-US/accessdev/
    http://social.answers.microsoft.com/Forums/en-US/addbuz/
    and see also http://www.utteraccess.com
     
    John W. Vinson, Apr 24, 2013
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.