New line in memo box

J

jwebster1979

I have a text box in a form that I want to feed into a memo box on the same
form I am having trouble getting this to work in VBA. I imagine that the user
would type their sentance or not in the text box and then click a button and
it would appear in the memo with a time tamp and the sentance. if they did a
new sentance and clicked again it would add to the memo on a new line and
keep any old info. ANy ideas?
 
D

Douglas J. Steele

Me.MyMemoField = Me.MyMemoField & _
IIf(Len(Nz(Me.MyMemoField, vbNullString)) > 0, vbCrLf, vbNullString) & _
Me.MyTextField
 
J

John W. Vinson

I have a text box in a form that I want to feed into a memo box on the same
form I am having trouble getting this to work in VBA. I imagine that the user
would type their sentance or not in the text box and then click a button and
it would appear in the memo with a time tamp and the sentance. if they did a
new sentance and clicked again it would add to the memo on a new line and
keep any old info. ANy ideas?

If you have some table with many notes, and you want each note timestamped
(and perhaps you also want the notewriter identified), I'd really strongly
suggest a different approach. It's hard to search or sort data in big memo
fields, and just dumping a lot of disparate information into a memo makes it
difficult to work with!

Consider instead having a one to many relationship to a Notes table, with a
foreign key to this table; a NoteTime, default value =Now() to automatically
timestamp it; a Text or Memo field for the note text; and perhaps a NoteBy
field for the author's name or logon ID. You could then have a Subform based
on this notes table.
 
J

jwebster1979

Thankyou that works great one more question. I also want a check box that
will turn the text red for a specific note and hold that color to draw
attention to to it. Or if it is not checked the text will be black and hold
that color. Let me know if you know how to do that. Either way I appreciate
your help!!
 
J

John W. Vinson

Thankyou that works great one more question. I also want a check box that
will turn the text red for a specific note and hold that color to draw
attention to to it. Or if it is not checked the text will be black and hold
that color. Let me know if you know how to do that. Either way I appreciate
your help!!

If you have all the data in one single big memo field, this will be difficult.
At the best you'll need to make it a Rich Text textbox (which will make it
even *more* difficult to search), with either manual selection of the text you
want to see in red or some REALLY complex VBA code. It would be much easier if
each note were in a separate record - then you could use conditional
formatting.
 

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