Textbox control

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a text box control on a form. I want to write
several lines of text, each on a separate line. I'm using,

me.TextboxControlName.Caption =
me.TextboxControlName.Caption & "New info" & chr(10) & chr
(13)


I loop through the above statement several time with new
information each time. Unfortunately, everything gets
pushed into one line (that is, the linefeed isn't working"


Any suggestions? Thank you.
 
2 things:

1) in code, use the vbCrLf constant for new lines

2) Check to see if you have the EnterKeyBehavior set to New Line in field
(True or -1, if checking in VBA)
 
Good Afternoon!

In place of the Chr(10) & Chr(13) combination try using
the Visual Basic for Applications constant:

vbCrLf

me.TextboxControlName.Caption =
me.TextboxControlName.Caption & "New info" & vbCrLf

Make sure you have the Reference to Visual Basic for
Applications turned on. Good Luck!
 
John,

I ran into the same problem a while back. I think I fixed
it by replacing your

& chr(10) & chr(13)

with

& vbLf & vbCr

or cleaner yet

& vbLfCr

Give that a try and see if it works. Someone smarter than
I am will have to explain why the Visual Basic Constants
for LineFeed and Carriage Return work where the chr(#)
construct does not.

Hope this helps.

-dc
 
dchendrickson said:
John,

I ran into the same problem a while back. I think I fixed
it by replacing your

& chr(10) & chr(13)

In queries and control expressions you have to use...

Chr(13) & Chr(10)

You need them both and in that order. If you had Chr(10) first then that
is why it didn't work.
 
You are using LF (10) / CR (13).

The correct linefeed sequence is CR (13) / LF (10).

As someone else said, use the appropriate built-in constant vbCrLf.

HTH,
TC
 
Back
Top