Access 2007 Memo field

royfarnol
StarLounger
Posts: 70
Joined: 24 Dec 2012, 20:26

Access 2007 Memo field

Post by royfarnol »

How does one get the cursor in a memo field to default to the beginning of that memo field in front of the first letter of text?

Thanks, Roy.

User avatar
HansV
Administrator
Posts: 78229
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 Memo field

Post by HansV »

If you mean a memo field in a table or query, there is no way to do that for one field specifically. It's governed by the "Behavior entering field" option, but that is an application-wide, user-level setting (it does not travel with the database).
S0863.png
On a form, you can use the On Enter event of the text box bound to the memo field. For example, for a text box named memNotes:

Code: Select all

Private Sub memNotes_Enter()
    With Me.memNotes
        .SelStart = 0
        .SelLength = 0
    End With
End Sub
This will work when the user tabs into the text box. When the user clicks in the text box, the insertion point will be where the user clicks.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

royfarnol
StarLounger
Posts: 70
Joined: 24 Dec 2012, 20:26

Re: Access 2007 Memo field

Post by royfarnol »

Thank you very much Hans. It is for a form not a table.

Much obliged, Roy.

BenCasey
4StarLounger
Posts: 495
Joined: 13 Sep 2013, 07:56

Re: Access 2007 Memo field

Post by BenCasey »

royfarnol wrote:How does one get the cursor in a memo field to default to the beginning of that memo field in front of the first letter of text?
Thanks, Roy.
Using Code:

To put the cursor at the start regardless of where the user clicked on the control, you could use:

Code: Select all

Private Sub PersonNote_GotFocus()
    Me!PersonNote.SelLength = 0
    Me!PersonNote.SelStart = 0
End Sub
To highlight the entire contents you could use:

Code: Select all

Private Sub NotifiedByEmail_Click()
        Me!NotifiedEmailAddress.SetFocus
        Me!NotifiedEmailAddress.SelStart = 0
        Me!NotifiedEmailAddress.SelLength = 50
End Sub
Regards, Ben

"Science is the belief in the ignorance of the experts."
- Richard Feynman

royfarnol
StarLounger
Posts: 70
Joined: 24 Dec 2012, 20:26

Re: Access 2007 Memo field

Post by royfarnol »

Thanks Ben.