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

x
?
Solved

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

Posted on 2011-02-18
7
Medium Priority
?
538 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 61

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 61

Accepted Solution

by:
HainKurt earned 1000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 61

Assisted Solution

by:HainKurt
HainKurt earned 1000 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

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

877 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