Solved

Append a new comment to an existing comments in a memo field using VBA (Access 2007)

Posted on 2011-02-18
7
465 Views
Last Modified: 2012-05-11
Hello, I would like to programmatically (VBA) append a new comment to a memo field that already has comments in it. The desired result should be to create a new line for the new comment.

This is how this will look like in the memo field:
This is the first comment.
This is the second Comment.
This is the third comment.

And NOT: This is the first comment. This is the second Comment. This si the third comment.
I need to use the hard return for each new comment

I am currently using:  
Me.Notes = Me.Notes & vbCrLf & "Kit mailed e-mail sent by " & Forms![Welcome]![UserName] & " on " & Date & "."

However, this does not give me hard return between the existing memo and the new appended note. I have also tried Chr(13) & Chr(10) instead of vbCrLf and I am getting the same result.





0
Comment
Question by:Cobra967
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
try:

Chr(10)
Chr(10) & Chr(13)
Chr(13)
"<br>" and enable format to rich text... I am not sure if this works in your case...

can you please post a sample db?
0
 

Author Comment

by:Cobra967
Comment Utility
See the attached example. Just open the form and click on the buttons to see the bad result.
NewNote.accdb
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 250 total points
Comment Utility
as I said before use

Me.Note = Me.Note & "<br>" & "This is note 1." 'Preserve the existing text, and a new line and add the next note
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 250 total points
Comment Utility
you can also use "<p>...</p>" or "<div>...</div>"
NewNote.accdb
0
 

Author Comment

by:Cobra967
Comment Utility
Hain, almost perfect. I am saying almost because if the memo alredy has a text in it. Then for some reason I amgetting blank line between the old note and the new one:

example:

This is the existing comment.
(this is where the blank line is)
New Comment 1
New Comment 2
New Comment 3

The way should be is:
This is the existing comment.
New Comment 1
New Comment 2
New Comment 3


0
 

Author Comment

by:Cobra967
Comment Utility
Just to be clear: I did not press enter (create a new blank line) when I typed in the old comment manually.
0
 

Author Comment

by:Cobra967
Comment Utility
Bingo! If I use <p>  or <div> will not create the blank space. Thank you for your help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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…
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.
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…

762 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

13 Experts available now in Live!

Get 1:1 Help Now