Enter carriage return in form Text Box

B

box2003

On an unbound form, I have a unbound text box which will write to a memo
field in the forms associated table on a save command. On the form I have a
text box which will serve as a memo box. With this memo box, I have an
associated command button when clicked will add a time stamp to the memo
box, at the top, and a carriage return, then I can enter text information.
This part works fine incorporating forms text box object reference and the
vbCrLf.

When I return to this form and record at a later time, and want to add more
comments, I wish to click the command button and have another time stamp
enter with carriage return, and have all text move down to allow additional
data entry. This part I am having problems with and need some help.
Instead of text moving, when I click the command button, the timestamp and
carriage return overwrites everything in the text box.

What I have tried so far on click of the command button is write the forms
existing content into a variable, execute the timestamp and carriage return
(vbCrLF) and then write the forms variable content back into the form text
box.

Any insight to how I might be able to successfully acheive my goal in the
problem description about will be appreciated. Thank you.
 
K

KARL DEWEY

I do not know what your command is but it sounds something like an update for
the field. Add to your command & [YourMemoField] or something along
the line to update the field with Datetime, CrLf, and the present contents on
the memo field.
 
B

box2003

Here is the code I ended up with and it works great for what my intentions
were

Private Sub btnPFMemo_Click()

Dim txtPFMemo As String

If IsNull(Me.PFMemo) Or Me.PFMemo = "" Then 'check to see if box is empty
Me.PFMemo = Now() & ""
Else
txtPFMemo = Me.PFMemo ' write text to variable
Me.PFMemo = Now() & vbCrLf & "This text is on line 1 and" & vbCrLf &
"this line is on line 2." & vbCrLf & vbCrLf & txtPFMemo & vbCrLf
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top