Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-03-15
3
Medium Priority
?
643 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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

916 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