Populating memo field by clicking command button

S

Steve Goodrich

I want to populate a memo field by clicking several command buttons

My memo field is called 'foodeaten'

I created a button without the wizard, right click and select build event,
go to code builder and enter the text:

If I use, Me.FoodEaten = "I enter my food eaten here" It places the text in
the memo field at the top, which is what I want.
Clicking my second button to enter a different food using the same code
overwrites my first entry.

If I use Me.FoodEaten = Me.FoodEaten & vbCrLf & "I enter my food eaten here"
It places the text on a new line with a blank line at the top of the memo
field.
My second entry is ok as it places it on a new line under my first entry.

It works great but I am left with a blank line in the memo field on every
record - and in all the reports that I create.

Is there a way to alter the code so that my first entry doesn't leave a
blank line and my second , third, forth entries don't overwrite each other?
Could finish up with 20 or 30 buttons and can be clicked in any order.

My wife has a condition where she needs to monitor her food intake very
carefully and I'm trying to setup a database to help her with repetitive
entries.

Thanks in advance for any assistance

Steve Goodrich
 
J

John Spencer

The following MIGHT work

Me.FoodEaten = Me.FoodEaten + vbCrlf & "Your phrase here"


This should definitely work (all one line):
Me.FoodEaten = Me.FoodEaten & IIF(Len(Me.FoodEaten & "")>0, vbCrlf,"") &
"Your Phrase Here"

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
S

Steve Goodrich

John,
Changed the & to a + as in your first suggestion and it works perfectly.
Many thanks
Steve
 

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

Similar Threads


Top