Remove a comma

N

nadesico

This might be a really simple question, but how do you remove a comma from
the end of a string? For example,

apple,
pear, grape,
orange, peach, apricot,

If there are three records in the same field and they all end with a comma,
how do you remove it? I used the following, but it changed the field to an
invalid data type

Fruit: Left([Field1], Len([Field1])-1)

I also tried another way but it only showed the friuts to the left of the
first comma only and not the rest

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

Is there another way so the above 2 results do not show up? Any help would
be greatly appreciated.
 
K

kc-mass

Your first example is correct. You want to check what you typed in the
query design panel.
I suspect a typing error not a syntax error.

Your second example would need to use the InstrRev function which finds the
last instance.
Fruit: Left ([Field1], InStrRev([Field1], ", ")-1)

Regards

Kevin
 

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