trim a field

N

nadesico

I am having trouble with this simple problem. I have a field that has every
entry ending with a comma. Example,

apple,
plum, pear,
grape, orange, peach,

and basically all I want to do is remove the last comma from each record. I
tried using

Fruit: Left([Field1], instr[Field1], ",")-1)

but this only displayed the first fruit and not the rest if there were more
than 1. Any help would be greatly appreciated.

Thanks
 
J

John Spencer

IF there is ALWAYS a trailing comma then you can use
LEFT([Field1],Len([Field1])-1)


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
M

MikeR

nadesico said:
I am having trouble with this simple problem. I have a field that has every
entry ending with a comma. Example,

apple,
plum, pear,
grape, orange, peach,

and basically all I want to do is remove the last comma from each record. I
tried using

Fruit: Left([Field1], instr[Field1], ",")-1)

but this only displayed the first fruit and not the rest if there were more
than 1. Any help would be greatly appreciated.

Thanks

If you have more than one fruit in a field, you have a serious design flaw.

Mike
 

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