Solved

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

Posted on 2004-04-22
12
1,000 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now