populate memo field with command button

  • Thread starter Thread starter Steve Goodrich
  • Start date Start date
S

Steve Goodrich

I use the following code to populate a memo field by clicking a command
button

Me.FieldName = Me.FieldName + vbCrLf & "Enter text here"

Works great but when the button is clicked and the text is entered, the
cursor disappears and I have to click in the memo box and hit return to move
to a new line.

Is the a small amendment that I can add to the code that will set the cursor
flashing on a new line once the text has been entered?

Thanks in advance for any help

Steve
 
HI John,

Tried your suggestion, the cursor is now visible but flashing at the end of
the line of text.
Can I force it to flash at the beginning of a new line.
Steve
 
You would have to add a new line character first.

Me.FieldName = Me.FieldName + vbCrLf & "Enter text here" & vbCrLf

Or if you did not want to add the newline unless you went to the field
you could add the new line just before moving to the end of the field.
Me.FieldName = Me.FieldName & vbcrlf
Me.FieldName.SetFocus
Me.FieldName.SelStart = Len(Me.FieldName)

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Thanks John
John Spencer said:
You would have to add a new line character first.

Me.FieldName = Me.FieldName + vbCrLf & "Enter text here" & vbCrLf

Or if you did not want to add the newline unless you went to the field you
could add the new line just before moving to the end of the field.
Me.FieldName = Me.FieldName & vbcrlf
Me.FieldName.SetFocus
Me.FieldName.SelStart = Len(Me.FieldName)

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