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);) How can I write a VBA 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
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 = date & ";"

But this does not keep adding the comments that were adding in yesterday to the comments that were adding in today. Could anyone help me solve this problem? Or, has anyone else encountered this problem? If so, how did you get around to solving it?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Should
Code:
me.legacy_comment.value = me.legacy_comment.value & "," & me.comment_date.value & ";"
me.legacy_comment.value = me.legacy_comment.value & "," & me.comment_date.value = date & ";"

be
Code:
me.legacy_comment.value = me.legacy_comment.value & "," & me.comment.value & "," & me.comment_date.value & ";"

I have not checked, but I think you need to start with the legacy commend and add both the new comment and the new date.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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