show last line in memo field

  • Thread starter bob92122 via AccessMonster.com
  • Start date
B

bob92122 via AccessMonster.com

Is there any way to have a memo field show the last line rather than the
first line as its default?

I have a memo field into which I put data from an "add comments" field using
memofield = memofield & timestamp & textfield. I would like the form to show
the last lines of text entered, rather than the first, by default. I know I
could append new comments to the top with memofield = timestamp & textfield &
memofield, but I prefer newer comments to be at the bottom.
 
K

KARL DEWEY

If you have some unique separator between comments like a carriage return
then try InStrRev to find it and parse using Right function.
 
L

Linq Adams via AccessMonster.com

If you're saying that you want the cursor to go to the end of the data
instead of the beginning when you move into the memo filed, this code will do
that:

Private Sub MemoBox_Click()
If Not IsNull(MemoBox) Then
If Len(MemoBox) < 32767 Then
MemoBox.SelStart = Len(MemoBox) + 1
Else
MemoBox.SelStart = 32767
End If
End If
End Sub

Private Sub MemoBox_Enter()
If Not IsNull(MemoBox) Then
If Len(MemoBox) < 32767 Then
MemoBox.SelStart = Len(MemoBox) + 1
Else
MemoBox.SelStart = 32767
End If
End If
End Sub

Because SelStart takes an Integer value, you cannot set it to more than 32767
or the code will bomb. Since memo fields can hold approximately 65K
characters, you have to settle for only going halfway to end if your memo
field gets that big. I use memo fields extensively and have never gone past
the 32k mark. If I remember correctly, 32k comes to about 10 8 x 10 pages of
single spaced text.
 
B

bob92122 via AccessMonster.com

Thanks. This looks like it will work, but I would really like to have it
show the bottom line even when the field is not selected. It would be the
equivalent of having a text flied right-justified.
 
B

bob92122 via AccessMonster.com

Thanks. This looks like it will work, but I would really like to have it
show the bottom line even when the field is not selected. It would be the
equivalent of having a text flied right-justified.
 

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