Setting new lines in textbox

P

PayeDoc

Hello All

I have a button that sets the text in a textbox, and the text needs to
include some carriage returns to give some new lines and blank lines. The
code I have is:

[Forms]![frmPDFFileName]![txtMessage].value = "Dear " & [prac mgr calling
name] & vbLf & _
"Please find attached P45 for " & [leavername] & ". Please note that these
'plain paper' P45s have been approved by HMRC, and replace the previous
'pre-printed stationery' versions which are to be phased out. &" _
& vbLf & vbLf & "Many thanks." & vbLf & [Forms]![frm x main]![Combo687] &
vbLf & "PayeDoc"

The problem is that the vbLf comes out as a thick vertical line within the
text, rather than a new line. Is there something else I can use?

Hope someone can help
Many thanks
Leslie Isaacs
 
M

Marshall Barton

PayeDoc said:
I have a button that sets the text in a textbox, and the text needs to
include some carriage returns to give some new lines and blank lines. The
code I have is:

[Forms]![frmPDFFileName]![txtMessage].value = "Dear " & [prac mgr calling
name] & vbLf & _
"Please find attached P45 for " & [leavername] & ". Please note that these
'plain paper' P45s have been approved by HMRC, and replace the previous
'pre-printed stationery' versions which are to be phased out. &" _
& vbLf & vbLf & "Many thanks." & vbLf & [Forms]![frm x main]![Combo687] &
vbLf & "PayeDoc"


You need both a Cr and Lf. Use the built-in vbCrLf
constant.
 
P

PayeDoc

Marshall

That's great - I thought there'd be a way!

Many thanks
Les



Marshall Barton said:
PayeDoc said:
I have a button that sets the text in a textbox, and the text needs to
include some carriage returns to give some new lines and blank lines. The
code I have is:

[Forms]![frmPDFFileName]![txtMessage].value = "Dear " & [prac mgr calling
name] & vbLf & _
"Please find attached P45 for " & [leavername] & ". Please note that these
'plain paper' P45s have been approved by HMRC, and replace the previous
'pre-printed stationery' versions which are to be phased out. &" _
& vbLf & vbLf & "Many thanks." & vbLf & [Forms]![frm x main]![Combo687] &
vbLf & "PayeDoc"


You need both a Cr and Lf. Use the built-in vbCrLf
constant.
 
P

PayeDoc

Dave

Wow - two ways to do it (vbCrLf, as suggested by Marshall, and vbNewLine)!!
Is there a difference?

Many thanks
Les

Klatuu said:
Use vbNewLine instead.

--
Dave Hargis, Microsoft Access MVP


PayeDoc said:
Hello All

I have a button that sets the text in a textbox, and the text needs to
include some carriage returns to give some new lines and blank lines. The
code I have is:

[Forms]![frmPDFFileName]![txtMessage].value = "Dear " & [prac mgr calling
name] & vbLf & _
"Please find attached P45 for " & [leavername] & ". Please note that these
'plain paper' P45s have been approved by HMRC, and replace the previous
'pre-printed stationery' versions which are to be phased out. &" _
& vbLf & vbLf & "Many thanks." & vbLf & [Forms]![frm x main]![Combo687] &
vbLf & "PayeDoc"

The problem is that the vbLf comes out as a thick vertical line within the
text, rather than a new line. Is there something else I can use?

Hope someone can help
Many thanks
Leslie Isaacs


.
 
M

Marshall Barton

PayeDoc said:
Wow - two ways to do it (vbCrLf, as suggested by Marshall, and vbNewLine)!!
Is there a difference?


Not on a Windows system. vbNewline will work on systems
that use different codes for a new line. AFAIK, that's a
moot point until Access modified to run on other systems.
 

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