Solved

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

Posted on 2012-03-15
3
531 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
Comment Utility
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
Comment Utility
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
Comment Utility
That worked--thanks!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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

5 Experts available now in Live!

Get 1:1 Help Now