Issues Replacing vbCRLF

  • Thread starter Thread starter Sharkbyte
  • Start date Start date
S

Sharkbyte

I have a string variable that I need to perform a REPLACE on, and then
truncate for a text field. However, when I added the REPLACE line, the
output of the LEFT command becomes 255 characters of text PLUS however many
"-" were added in the REPLACE. Where before it was strictly 255 with the
embedded CRLF. Am I missing something?

gString6 = Replace(gString6, vbCrLf, "-")
gString6 = Left(gString6, 255)

Any help would be appreciated.
 
Hi Sharkie,

I'm not able to reproduce your findings. I started with a gstring6 text that
includes (3) vbCrLf and is 273 characters in length. After the Replace
operation, my string is 270 characters in length. And after this line of code:

gString6 = Left(gString6, 255)

my string is exactly 255 characters in length, as revealed by a debug
statement:

Debug.Print Len(gString6)



Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
Thanks, Tom. I never was able to get those two lines to work; however, I
moved the LEFT before the REPLACE, and it worked.
 
Back
Top