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

Access, HTML email, memo fields and new lines/carriage returns

Posted on 2012-03-15
3
569 Views
Last Modified: 2012-03-15
Hello;

I've built a function in our access database that generates an HTML email and populates some of the body of the email from a few different records in the database.  (So I've essentially wrapped HTML within access code by setting .HTMLBody = "htmlCodeHere").

I used to send this email out using SendObject format TXT, now writing this to create a pretty HTML email.

It works great, with one exception:  I have a memo field in the database where users enter data: some times sentences, some time paragraphs, always with several carriage returns/new lines.  The problem: HTML doesn't interpret these as enters/new lines when formulating the email.  

Example, if the memo field has the following data:

* line one here
* line two here
* line three here

It will output in the email as:

* line one here * line two here * line three here.

Obviously the HTML tag for new line is <br>, but how do I get the database or HTML to interpret the new lines in the memo field into a new line in the HTML code?

Thanks all.
0
Comment
Question by:Uptime Legal Systems
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37725499
Not sure how you are getting your memofield out of your database, but assuming that you have read it into a string variable, you could try replacing the carriage returns with <br> tags to formulate your html message:


strHTMLMessage = Replace(strYourMemoField, vbCRLF, "<br>")
0
 
LVL 6

Author Comment

by:Uptime Legal Systems
ID: 37725533
Yes, I read it into a String.  Essentially:

strBody = me.Body
.htmlBody = strBody

So would I replace this with:

strBody = me.Body
.htmlBody = Replace(strBody),vbCRLF,"<br>")

?
0
 
LVL 6

Author Comment

by:Uptime Legal Systems
ID: 37725561
That worked--thanks!
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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

856 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