Solved

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

Posted on 2004-04-22
12
1,003 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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 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…

862 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