Multiple lines in one text box

S

Steven Sutton

I am creating a 24 hour schedule where the size of a text box on the report
(txtJobName) is altered programmaticaly to match the length of the job in
time. (Hope that makes sense!) Anyway, what I would like to do is put several
lines of type into the textbox but can't figure out how to do it. For
example, line 1 should be teh job's name which comes from a Query. I would
like line 2 to be another field from the same query (JobConfig). I don't want
to concatenate them into one line, I want them to be distinct lines.
Something like this:

Job Name
Job Config
Color Specs
Quantity

I can create a field in the Query that combines the other fields but I do
not kknow how to force each line to be a separate line. I tried adding a vbCr
into the concatenation but that was not the right thing to do. Anyone have
any suggestions??

Thanks
 
J

John Spencer

If you want to concatenate the fields in a calculated query field you will
have to use Chr(13) & Chr(10) to get a new line

For example:

[JobName] & Chr(13) & Chr(10) & [JobConfig] & Chr(13) & Chr(10) & [Color
Specs] & Chr(13) & Chr(10) & [Quantity]


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
F

fredg

I am creating a 24 hour schedule where the size of a text box on the report
(txtJobName) is altered programmaticaly to match the length of the job in
time. (Hope that makes sense!) Anyway, what I would like to do is put several
lines of type into the textbox but can't figure out how to do it. For
example, line 1 should be teh job's name which comes from a Query. I would
like line 2 to be another field from the same query (JobConfig). I don't want
to concatenate them into one line, I want them to be distinct lines.
Something like this:

Job Name
Job Config
Color Specs
Quantity

I can create a field in the Query that combines the other fields but I do
not kknow how to force each line to be a separate line. I tried adding a vbCr
into the concatenation but that was not the right thing to do. Anyone have
any suggestions??

Thanks

In Access you must use the combination of Chr(13) & chr(10) (in that
order).

Or, using Code you can use
vbCrLf or vbNewLine or chr(13) & cht(10).

In an unbound control's control source, use:
=[JobName] & chr(13) & chr(10) & [JobCoding] & chr(13) & chr(10) &
etc...
 
M

Marshall Barton

Steven said:
I am creating a 24 hour schedule where the size of a text box on the report
(txtJobName) is altered programmaticaly to match the length of the job in
time. (Hope that makes sense!) Anyway, what I would like to do is put several
lines of type into the textbox but can't figure out how to do it. For
example, line 1 should be teh job's name which comes from a Query. I would
like line 2 to be another field from the same query (JobConfig). I don't want
to concatenate them into one line, I want them to be distinct lines.
Something like this:

Job Name
Job Config
Color Specs
Quantity

I can create a field in the Query that combines the other fields but I do
not kknow how to force each line to be a separate line. I tried adding a vbCr
into the concatenation but that was not the right thing to do.


You need to use cr and lf in that order. In VBA you can use
vbCrLf, but in a query or a text box expression, you need to
use Chr(13) & Chr(10)
 
S

Steven Sutton

Thanks to all who responded. Using the Chr(13) & Chr(10) in teh query worked
like a charm. Thanks again!

Steven

John Spencer said:
If you want to concatenate the fields in a calculated query field you will
have to use Chr(13) & Chr(10) to get a new line

For example:

[JobName] & Chr(13) & Chr(10) & [JobConfig] & Chr(13) & Chr(10) & [Color
Specs] & Chr(13) & Chr(10) & [Quantity]


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Steven Sutton said:
I am creating a 24 hour schedule where the size of a text box on the report
(txtJobName) is altered programmaticaly to match the length of the job in
time. (Hope that makes sense!) Anyway, what I would like to do is put
several
lines of type into the textbox but can't figure out how to do it. For
example, line 1 should be teh job's name which comes from a Query. I would
like line 2 to be another field from the same query (JobConfig). I don't
want
to concatenate them into one line, I want them to be distinct lines.
Something like this:

Job Name
Job Config
Color Specs
Quantity

I can create a field in the Query that combines the other fields but I do
not kknow how to force each line to be a separate line. I tried adding a
vbCr
into the concatenation but that was not the right thing to do. Anyone have
any suggestions??

Thanks
 

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