Adding a carriage return in a query

  • Thread starter Thread starter ANDY PHILLEY
  • Start date Start date
A

ANDY PHILLEY

I have a query that glues together several fields from a
table into a new field. I want to put a carriage return
in the mix. Is that possible?


Example:

Field 1 ANDY
Field 2 IS
Field 3 A BOY
Field 4 OF THE
FIELD 5 WORLD

Query: [FIELD1]&" "&[FIELD2] - CARRIAGE RETURN - [FIELD3]
&" "&[FIELD4]&[FIELD5]


OUTPUT in 1 cell

ANDY IS
A BOY OF THE WORLD
 
Hi Andy,

I have always used Chr(13) & Chr(10) together. I believe
one is a line return and one is a line feed. I'm not
completely sure if both are necessary, one of those
things that I've always done without really thinking
closely about it (hopefully someone else will post if
there is an easier way. Using this, your formula would
become:

[FIELD1] & " " & [FIELD2] & chr(13) & chr(10) & [FIELD3]
& " " & [FIELD4] & " " & [FIELD5]

-Ted Allen
 
Add a carriage return and linefeed characters - Chr(13) & Chr(10). Both are
required and in the stated order.

Field: Combined: Field1 & Field2 & Chr(13) & Chr(10) & Field3 & ...
 
Hi Andy,

I have always used Chr(13) & Chr(10) together. I believe
one is a line return and one is a line feed. I'm not
completely sure if both are necessary, one of those
things that I've always done without really thinking
closely about it (hopefully someone else will post if
there is an easier way. Using this, your formula would
become:

[FIELD1] & " " & [FIELD2] & chr(13) & chr(10) & [FIELD3]
& " " & [FIELD4] & " " & [FIELD5]

-Ted Allen

Ted,
You are correct. In a query (or in an Access Control source) you must
use both chr(13) & chr(10) in that order.

In a VBA code window, in addition to the above, you could also use
either vbNewLine or vbCrLf.
 
Rock ON!

That did it.

-----Original Message-----
Add a carriage return and linefeed characters - Chr(13) & Chr(10). Both are
required and in the stated order.

Field: Combined: Field1 & Field2 & Chr(13) & Chr(10) & Field3 & ...

ANDY said:
I have a query that glues together several fields from a
table into a new field. I want to put a carriage return
in the mix. Is that possible?

Example:

Field 1 ANDY
Field 2 IS
Field 3 A BOY
Field 4 OF THE
FIELD 5 WORLD

Query: [FIELD1]&" "&[FIELD2] - CARRIAGE RETURN - [FIELD3]
&" "&[FIELD4]&[FIELD5]

OUTPUT in 1 cell

ANDY IS
A BOY OF THE WORLD
.
 
Back
Top