Solved

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

Posted on 2011-02-18
7
473 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
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 51

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
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.

 
LVL 51

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 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

22 Experts available now in Live!

Get 1:1 Help Now