Select from current cursor position to end of memo field in a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
You are so awesome, Allen! I am using it with AutoKey shortcut. Works great!

All the best!
 
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?
 
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.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
The other option might be to set the default behavior for all text boxes so
the cursor goes to the end of the field.
 
You know, Allen, I never thought of that! I generally leave everything in
Options to default and address every control according to requirements!
Thanks!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Back
Top