Memo Pop-Up

K

kirstie adam

I have a form which is a simple pop-up with 2 fields on it, 1st field is the
prmary key to link to another form, and the 2nd field is just a really big
memo box which is used for the user to makes comments and to/do actions on
that case. The only other thing is an exit form button.
My problem is when the user opens the form, all the text they have already
written is highlighted. One-click and they wipe it away by mistake.
I want that when they open this form, the cursor is blinking away at the end
of the already written text. Am sure it can be done, just need someone to
tell me how!!!

Any suggestions much appreciated (especially ones that work!)

Kirstie
 
B

Bob L.

* kirstie adam said:
I have a form which is a simple pop-up with 2 fields on it, 1st field is the
prmary key to link to another form, and the 2nd field is just a really big
memo box which is used for the user to makes comments and to/do actions on
that case. The only other thing is an exit form button.
My problem is when the user opens the form, all the text they have already
written is highlighted. One-click and they wipe it away by mistake.
I want that when they open this form, the cursor is blinking away at the end
of the already written text. Am sure it can be done, just need someone to
tell me how!!!

Any suggestions much appreciated (especially ones that work!)

Kirstie
Kirstie,

Try this:

Private Sub Form_Current()
With Me.tbxMemo
.SetFocus
.SelStart = Len(.Value)
End With
End Sub

HTH
Bob L.
 
K

kirstie adam

excellent, worked perfectly thanks

Bob L. said:
Kirstie,

Try this:

Private Sub Form_Current()
With Me.tbxMemo
.SetFocus
.SelStart = Len(.Value)
End With
End Sub

HTH
Bob L.
 
K

kirstie adam

Tank,

Genius!
worked better than the SelLengh solution Bob (sorry Bob!) gave me as it
means i can see all the text when the forms open rather than having to
scroll back up, which is good when i just want to read what's there and not
necessarily edit the text.

Thanks to both of you for your help.

Kirstie
 
M

missinglinq via AccessMonster.com

Don't know how "really big" this memo field usually is, Kirstie, memo fields
can be 65k, but if it passes 32,767 characters the SelStart will throw an
overflow error. That's because SelStart's arguement is an Integer. To work
around this I use the following:

If Not IsNull(MemoBox) Then
If Len(MemoBox) < 32767 Then
MemoBox.SelStart = Len(MemoBox) + 1
Else
SendKeys "^{END}"
End If
End If

I don't really like using SENDKEYS, which is why I only invoke it if the memo
field is too big to use SelStart, but sometimes you have to.
 
M

missinglinq via AccessMonster.com

Should have explained, the

SendKeys "^{END}"

is the same as keying <Control> + <End>.
 
Top