Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a Carriage return to a string 2

Status
Not open for further replies.

slaman

Programmer
Jun 8, 2001
47
CA
I want to add an carriage return to a string if it exceeds a certain length. I thought this would be easy (simply add a & Chr(13)) but for some reason, it displays a little black box instead of actually doing a carriage return. Any ideas?
 
It's for a textbox on a form.

[Text Box Name] = stringName1 + Chr(13) + stringName2

is basically what I am trying to do to have the stringName1 and stringName2 display on two separate lines.
 
Take your pick...

Chr(13) & chr(10) ' <--- Instead of just Chr(13).

OR

vbCrlf ' <--- Builtin carriage return

Example:

Me.txtBox = IIF(Len(Nz(Me.txtBox,&quot;&quot;) > 12, Me.txtBox & vbcrlf, me.txtbox)

Hope that helps.

Gary
gwinn7
 
Whoops! My example is missing a right parenthesis. Here is my example modified...

Me.txtBox = IIF(Len(Nz(Me.txtBox,&quot;&quot;)) > 12, Me.txtBox & vbcrlf, Me.txtBox)

Gary
gwinn7
 
Chr(13) & chr(10) worked wonders... the second one didnt.. I assume it's Access 2002 syntax again...
 
I have a similar question, just backwards. I have a linked HTML file and when it's brought in, there is a carriage return in the field. Basically the carriage return is between the &quot;field name&quot; and the &quot;value&quot;(but both are in one field). Is there any way I can seperate the two within a query and have them in seperate fields?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top