Remove only the last comma

G

Garry

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
 
P

Puppet_Sock

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

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
 
J

John W. Vinson

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

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top