Set SelLength to the length of the text in the field, less SelStart:
With Me.Memo1
.SelLength = Len(.Text) - .SelStart
End With
Note that you cannot do this in the Click event of a command button: once
focus moves to the button, the memo's selection point is lost.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Anyone know how I can do this with SelStart/SelLength? I don't know how to
> specify the start to be the current cursor position.
>
> thanks.
justme - 13 Mar 2007 12:11 GMT
You are so awesome, Allen! I am using it with AutoKey shortcut. Works great!
All the best!
missinglinq - 15 Mar 2007 03:02 GMT
Allen,
Since SelLength and SelStart both take an Integer as a value, if
.SelLength = Len(.Text) - .SelStart > 32767
this code will throw an Overflow error, will it not?

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
Allen Browne - 15 Mar 2007 03:30 GMT
Yes.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Allen,
>
[quoted text clipped - 3 lines]
>
> this code will throw an Overflow error, will it not?
missinglinq - 15 Mar 2007 15:39 GMT
Do you know a work araound for this? I use a routine to send the cursor to
the end of the text in a memo field:
If Not IsNull(MemoNotes) And Len(MemoNotes) < 32767 Then
MemoNotes.SelStart = Len(MemoNotes)
Else:MemoNotes.SelStart = 0
End If
I tried in the Else Statement using SendKeys (I know, don't say it!) to move
it to the end if the characters count was over 32767, but it sends the cursor
to the end of the field in the last record in the db instead of to the end of
field in the current record.

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
Allen Browne - 15 Mar 2007 16:15 GMT
The other option might be to set the default behavior for all text boxes so
the cursor goes to the end of the field.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Do you know a work araound for this? I use a routine to send the cursor to
> the end of the text in a memo field:
[quoted text clipped - 11 lines]
> of
> field in the current record.
missinglinq - 15 Mar 2007 17:30 GMT
You know, Allen, I never thought of that! I generally leave everything in
Options to default and address every control according to requirements!
Thanks!

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000