Remove Extra Carriage Returns

  • Thread starter Thread starter Toxalot
  • Start date Start date
T

Toxalot

The data I'm working with has memo fields with lots of trailing
carriage returns. I want to get rid of them. I'm using VBA. Is there a
RTrim type function that would get rid of carriage returns?

Jennifer
 
You need to use the Replace() function.

Replace(vbCrLf,"")

Look it up in the help for more options/information.

Steve
 
Of course, that will also remove any carriage returns inside the text.

Also, the syntax for the Replace function is Replace(TextToChange, vbCrLf,
"")
 
The data I'm working with has memo fields with lots of trailing
carriage returns. I want to get rid of them. I'm using VBA. Is there a
RTrim type function that would get rid of carriage returns?

Jennifer

It would be a bit tedious, but an Update query updating the field to

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

with a query criterion on the field of

LIKE "*" & Chr(13) & Chr(10)

would trim off the last CrLf in the field. Running the query repeatedly
(perhaps from code) would nibble them all off eventually.

John W. Vinson [MVP]
 
Back
Top