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
Solved

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

Posted on 2004-04-22
12
1,005 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
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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 125 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

840 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