Delete comma from the end of a field

  • Thread starter Thread starter Dimitris
  • Start date Start date
D

Dimitris

Hello in a field every word of every entry ends with a comma. How can I
delete that comma from every word of the field?
Thanks in advance
Dimitris
 
Depends upon whether there are any commas within the words that you need to
retain, or if you want to just delete all commas. Post some example data
here (include any where you wouldn't want to delete a comma).
 
Dimitris said:
Hello in a field every word of every entry ends with a comma. How can I
delete that comma from every word of the field?
Thanks in advance
Dimitris

You could remove all commas from the field using the replace function to
repalce the comma with a blank string, eg:

Replace(",dog,cat,mouse,",",","")

Returns "dogcatmouse"

.... or were there some commas you needed to keep?
 
This query sould delete only the last comma

update mytable
set myfield=iif(Right(myfield, 1) = ",", Left(myfield, (Len(myfield) - 1)),
myfield)
where len(myfield)>0
 
Thank you all for your answers.
There are more commas in the field and I only want the last one deleted. The
last one is always at the end. So every entry ends with a comma.
I tried to do what Alex suggested but couldn't make it. I am new in Access
and am not sure where to write everything. I need to ask for more detailed
help, where exactly to write the code. If it helps the table is named
"DEntry" and the field with the data "Dief".
Thank you once again for your help.
Dimitris
 
Run an update query similar to this:

UPDATE TableName
SET FieldName = Left([FieldName], Len([FieldName]) - 1);
 
Thanks for your help Ken. It worked fine.


Ken Snell said:
Run an update query similar to this:

UPDATE TableName
SET FieldName = Left([FieldName], Len([FieldName]) - 1);
--

Ken Snell
<MS ACCESS MVP>



Jimmy said:
Thank you all for your answers.
There are more commas in the field and I only want the last one deleted.
The last one is always at the end. So every entry ends with a comma.
I tried to do what Alex suggested but couldn't make it. I am new in
Access and am not sure where to write everything. I need to ask for more
detailed help, where exactly to write the code. If it helps the table is
named "DEntry" and the field with the data "Dief".
Thank you once again for your help.
Dimitris
 
Back
Top