Formatting text in a label or text box

B

Ben

Hi all,

Access 2003. I want to ask how to you format text in a label or text
box. I wanted to break a line of text into several different lines. I
tried using chr(13) or the chr (10), but it still would not break the
text into different lines. On top of that, it displayed the ASCII
character of the text box/ label, an outline of a square. Can you share
some thoughts on how I can achieve what I need?

Thanks,

Ben
 
K

Klatuu

Lables and text boxes are different, but since you mention both, I am
assuming you mean the Caption property of the label. The easy way for that
is to enter what you want on the first line then hold the shift key and press
enter. That will give you multiple lines in a caption.
 
J

John Spencer MVP

You need both Chr(13) & Chr(10) to insert a line break in Access fields. They
also need to be in that order.

If you are using VBA to do this then you can use the VBA constant vbCrLF in
the concatenation.

"xxxxx" & vbCrLf & "YYYY" will return
xxxxx
YYYY

or

"xxxxx" & Chr(13) & Chr(10) & "YYYY" will return
xxxxx
YYYY

In a query, you need to use Chr(13) & Chr(10) since the query engine does not
recognize the Visual Basic constants.


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top