populate memo field with command button

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
 
S

Steve Goodrich

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
 
J

John Spencer

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
'====================================================
 
S

Steve Goodrich

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
'====================================================
 

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