By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,072 Members | 1,168 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,072 IT Pros & Developers. It's quick & easy.

Insert CR/LF into text box

JustJim
Expert 100+
P: 407
Trying to help buddyr in another question, I came across a little quirk I couldn't immediately sort out.

I was building a string from the contents of a list box on a form, with the idea of filling a text box on a report and I wanted to insert CR between each item of the list using Chr(13), but that didn't work.

I know that when entering text into a text box, if you want a new line, you type <Alt><Enter>. How can I concatenate that into a string?

I've missed you guys!

Jim
Apr 13 '09 #1
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
Simplest way is

FirstField & vbNewLine & SecondField

but you could use

FirstField & Chr(13) & Chr(10) & SecondField


Linq ;0)>
Apr 13 '09 #2

JustJim
Expert 100+
P: 407
@missinglinq
Sacre Flipping Bleu!

Thanks Linq, I tried both Chr(10) and Chr(13) but even though I knew what I wanted was a CR and a LF, I didn't think to use both! vbNewLine is probably neater so I'll go back and fix my reply.

Thanks again

Jim
Apr 13 '09 #3

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help!

Linq ;0)>
Apr 13 '09 #4

NeoPa
Expert Mod 15k+
P: 31,709
Just as an FYI, vbNewLine is an AKA of vbCrLf. Both are two character strings of CR (Chr(13)) & LF (Chr(10)) (which can be referred to individually as vbCr & vbLf).
Apr 13 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.