Adding carriage return into text - How? e.g. "I want"+<CR>+"here"

K

KJA

I want to insert a carriage return into text being updated in a text field in
Access, like this:

"This part is due on this date: " & Format([Table1][DateDue1],"mm/dd/yyyy")
& "And" & [Ctrl + Enter] & This second part is due: " &
Format([Table1][Datedue2],"mm/dd/yyyy"), with the printout looking like this:

This part is due on this date: 12/1/2001
The second part is due: 12/15/2001

Any suggestions? Thanks.
 
J

John W. Vinson

I want to insert a carriage return into text being updated in a text field in
Access, like this:

"This part is due on this date: " & Format([Table1][DateDue1],"mm/dd/yyyy")
& "And" & [Ctrl + Enter] & This second part is due: " &
Format([Table1][Datedue2],"mm/dd/yyyy"), with the printout looking like this:

This part is due on this date: 12/1/2001
The second part is due: 12/15/2001

Any suggestions? Thanks.

Use

& Chr(13) & Chr(10)

to insert a carriage return-line feed pair. The literal expression to get your
stated result would be

"This part is due on this date: " & Format([Table1].[DateDue1],"mm/dd/yyyy")
& Chr(13) & Chr(10) & "The second part is due: " &
Format([Table1].[Datedue2],"mm/dd/yyyy")

Note that I added . between the table and fieldnames, and an additional quote
before "The second..."

John W. Vinson [MVP]
 
D

Douglas J. Steele

I think you're find that that wll put a small rectangle in the text box,
rather than a line feed.

Access insists on both a Carriage Return (Chr$(13)) and a Line Feed
(Chr$(10)), in that order. In VBA code, you can use the intrinsic constant
vbCrLf instead.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


UpRider said:
Instead of
& [Ctrl]+[Enter] &
try
& Chr$(10) &

UpRider

KJA said:
I want to insert a carriage return into text being updated in a text field
in
Access, like this:

"This part is due on this date: " &
Format([Table1][DateDue1],"mm/dd/yyyy")
& "And" & [Ctrl + Enter] & This second part is due: " &
Format([Table1][Datedue2],"mm/dd/yyyy"), with the printout looking like
this:

This part is due on this date: 12/1/2001
The second part is due: 12/15/2001

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