?
Solved

Carriage Return needed in body of VBSCRIPT generated e-mail message

Posted on 2004-04-22
12
Medium Priority
?
1,012 Views
Last Modified: 2007-12-19
Hi Experts, I am using a Data Access Page with a button to generate a mail message and populate the TO, SUBJECT and BODY areas.  The code below works fine, but I need to ammend it in some way that will include the [Contact_Name] field on a new line (carriage return) under the [Company_Name].

This is what I have sof far:

------------------
window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value
------------------

Which displays the following in a new message, ready for the user to click the 'Send' button:

------------------
To:  Sales Staff Name
Subject: Technical Support Ref: 1234

Message Body:
Company Name: Bloggs & Co
------------------

I would like to display the [Contact_Name] on the next line e.g.

Company Name: Bloggs & Co
Contact Name: Joe Bloggs

Please help.....

0
Comment
Question by:westermo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 10887572
hello again, lets hope they dont change the design again eh, lol


In vb you would add VBCRLF or VBCR


window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & vbcrlf & "XXXX"

this would add XXXX on a new line

try it in this
0
 
LVL 2

Author Comment

by:westermo
ID: 10887623
Hi rockiroads !!

Would have been a perfect quick solution BUT.... it doesn't work :(  Neither vbcr or vbcrlf made any difference - not even an error message.  Funnily enough I can replace either with any text and it's just ignored.

Thanks tho, Any other ideas?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10887633
is it possible to output this?

\r\n

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 2

Author Comment

by:westermo
ID: 10887643
Syntax error shows when using \r\n as follows

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & \r\n & "dummy text"
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10887685
should be:

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & "\r\n" & "dummy text"
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10887692
\r\n is a string, like Arthur has done, it has to go into quotes,

Im not sure if it will work, but give it a shot
0
 
LVL 2

Author Comment

by:westermo
ID: 10887713
Thanks and sorry guys, because its surrounded by quotes, it displays in the body message as follows:

Company Name: Bloggs & Co\r\ndummy text

0
 
LVL 1

Accepted Solution

by:
dssdb earned 500 total points
ID: 10887844
Try This..

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & "%0D%0A" & "dummy text"
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10887868
is it possible to define a string first

x = "..." & vbcrlf & "..."

window.open ... & x

0
 
LVL 17

Expert Comment

by:aflockhart
ID: 10887970
Maybe this ?

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & chr(13) & chr(10) & "Contact name etc"
0
 
LVL 2

Author Comment

by:westermo
ID: 10888005
Hey guys  Thanks for all your help.  Colleagues of mine tried the chr 10 and 13 but these were also ignored.

:D  dssdb has hit the nail on the head with this one with his advice as follows:

"%0D%0A"

This works a treat - so it's only fair I give him the points - hope you all agree.  Many thanks to ALL of you.  Until next time rockiroads :D I'm sure....

Thanks again
0
 

Expert Comment

by:sparky__
ID: 11106016
cheers.. %0D%0A worked a treat... the ms knowlege base lies i tel ya!! they suggest using Line1%250dLine2 but that just comes up with Line1%0dLine2
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question