Carriage Return in Text Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the CanShrinkLines function in a text box on a report. I have
shortened the syntax but I definitely want a carriage return after a certain
entry. After [txtEntityZipCode] I want a carriage return but the Chr$(10) is
not working. Is it even possible to do this? Thanks

=CanShrinkLines([txtReqEntity1],[txtReqEntity2],[txtEntityZipCode] &
Chr$(10) & [txtIndividualFirst] & " " & [txtIndividualLast])

Lamar
 
In code, you need to use the constant

vbCrLF

In your expression, the above may not be available, so, I would use
=CanShrinkLines([txtReqEntity1],[txtReqEntity2],[txtEntityZipCode] &
chr$(13) & Chr$(10) & [txtIndividualFirst] & " " & [txtIndividualLast])

So, for a new line, you need a cr + lf (carriage return + line feed). This
is the same character used when you hit control-enter in a field to start a
new line (or, if you set the text box settings to start a new line when
Enter key is hit).
 
It worked. I have another question. In my expression sometimes I just want
to use Chr$(13) but then a little square box appears on the report. Is there
a way to get rid of the little box?

Albert D.Kallal said:
In code, you need to use the constant

vbCrLF

In your expression, the above may not be available, so, I would use
=CanShrinkLines([txtReqEntity1],[txtReqEntity2],[txtEntityZipCode] &
chr$(13) & Chr$(10) & [txtIndividualFirst] & " " & [txtIndividualLast])

So, for a new line, you need a cr + lf (carriage return + line feed). This
is the same character used when you hit control-enter in a field to start a
new line (or, if you set the text box settings to start a new line when
Enter key is hit).


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal
 
The only way in Access is to use both Chr(13) and Chr(10) in that order. Or
don't use them at all. If you use one without the other you will get the
"little square box".

The only place I can think of that this ****might**** not be true is when
building a string for the msgbox function. I don't know. I just always use the
combination of characters, so I don't need to recall when the alternative might work.
It worked. I have another question. In my expression sometimes I just want
to use Chr$(13) but then a little square box appears on the report. Is there
a way to get rid of the little box?

Albert D.Kallal said:
In code, you need to use the constant

vbCrLF

In your expression, the above may not be available, so, I would use
=CanShrinkLines([txtReqEntity1],[txtReqEntity2],[txtEntityZipCode] &
chr$(13) & Chr$(10) & [txtIndividualFirst] & " " & [txtIndividualLast])

So, for a new line, you need a cr + lf (carriage return + line feed). This
is the same character used when you hit control-enter in a field to start a
new line (or, if you set the text box settings to start a new line when
Enter key is hit).


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal
 
Back
Top