Solved

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

Posted on 2011-02-18
7
511 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
[X]
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
  • 4
  • 3
7 Comments
 
LVL 56

Expert Comment

by:HainKurt
ID: 34926855
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
ID: 34927018
See the attached example. Just open the form and click on the buttons to see the bad result.
NewNote.accdb
0
 
LVL 56

Accepted Solution

by:
HainKurt earned 250 total points
ID: 34927101
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 56

Assisted Solution

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

Author Comment

by:Cobra967
ID: 34927238
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
ID: 34927275
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
ID: 34927353
Bingo! If I use <p>  or <div> will not create the blank space. Thank you for your help.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

628 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