Full Version: Insert linebreak into textbox from VB
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Manngo
Hello

I have a form, with a textbox. I want my VB code to write messages (log) to this textbox. Unfortuntelly I cannot manage with inserting linebreaks.
The control is a Textbox and the EnterKeyBehavior is 'New Line in Field'.

I tried this:
Forms!uploaddata!Log.SetFocus
Forms!uploaddata!Log.Text = Forms!uploaddata!Log & "Loading file..." & Chr(10)

and also tried with Chr(13), but neither worked. All the text appears in the Textbox, except the line breaks.

I'm using Access 2000.

Many thanks in advance
Manngo
xteam
Try
String1 & vbCrLf & String2
Aazzner
I have found that you need to use both in order to make it work.
"string" & Chr(10) & Chr(13) & "string"
That is the only way it would work for me.
I am assuming the vbCrLf is the vb character representation of the same thing
Cr = chr(10)
Lf = chr(13)

Hope it helps.
xteam
I think vbCr > CarriageReturn is Chr(13) and vbLf > LineFeed is Chr(10)
Manngo
This one worked:
String1 & vbCrLf & String2

Thanks a lot!
xteam
You're welcome!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.