Issues Replacing vbCRLF

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.
 
T

Tom Wickerath

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/
__________________________________________
 
S

Sharkbyte

Thanks, Tom. I never was able to get those two lines to work; however, I
moved the LEFT before the REPLACE, and it worked.
 

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