Problem with adding comments to a text box, and having the text box keep updating and NOT deleting the text that currently is in the text box.

database_coder

New Member
Joined
Feb 6, 2014
Messages
35
Hi all, I have a form that has three fields (1. Comments (TEXT), 2. Legacy_Comments (TEXT), 3, Comment date (DATE))

Now my users need to keep adding comments to the comment text box, and when they do it automatically adds the date they entered the comment in the Comment date box. Now my problem is that since they keep adding comments to the comment box, I need to keep track of these comments in the Legacy_Comments (Text box).

For example, the First time a user enters a comment into the (1) comment text box it auto populates the date in the comment date box, and then adds the comment and date to the Legacy_Comment box. the end result is (comment,4/3/2014;) now lets say a user needs to add a comment to the comments box tomorrow - I want the legacy_Comment box to then read (comment, 4/3/2014; comment2, 4/4/2014, ...., comment(n),date(n)) OR it can be vice-verse, because I just need to keep track of the comments, I am not worried if the new comments are before or after older (yesterdays / the day before yesterdays comments)

How can I write a
<acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> code that will always add the new comment to the legacy_comment field, without deleting the comments that were entered previously?

So far I have tried, but no success.

Code:
If isnull(me.comment.value) Then   
     Exit Sub
ElseIf me.comment.value = true Then 
     me.comment_date.value = date   
     me.legacy_comment.value = me.comment.value & "," & me.comment_date.value & ";" 
     me.legacy_comment.value = me.legacy_comment.value & "," & me.comment_date.value & ";"


It adds the comment only the first time, but it does not concatenate the string from yesterday to the string to today. I do not care which order the comments are, meaning if I added a comment today it can be before OR after the comment from yesterday.

Could anyone help me solve this problem? Or, has anyone else encountered this problem? If so, how did you get around to solving it?
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Perhaps a version of something like this. (This is a snippet from code that populates a TextBox)

If you wanted the comments each on it's own line then where you see the [ = " " & ] you could put [ vbCr & ].

Where MyStringVariable is the comment.

Regards,
Howard

Code:
    With ActiveSheet.TextBox1
      If Len(.Text) > 0 Then MyStringVariable = " " & MyStringVariable
      .Text = .Text & MyStringVariable
    End With
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top