Finding length of long text (1 Viewer)

ClaraBarton

Registered User.
Local time
Today, 08:33
Joined
Oct 14, 2019
Messages
463
1687356220766.png
When I click on the "to notes" buttons, I add the current date to the notes box. I'd like to add the date and then jump to the end of the notes to add more notes.
Code:
Public Sub AddToNotes()
Dim intTextLen As Integer

    Me!CNotes.SetFocus
    intTextLen = Len(CNotes)
    Me.CNotes.SelStart = intTextLen
End Sub
At first it works, then each time the cursor goes a couple extra lines down. Somehow the Len is adding something at the end.
What am I missing?
 

ClaraBarton

Registered User.
Local time
Today, 08:33
Joined
Oct 14, 2019
Messages
463
Sorry... this is how I add it to begin with:
Code:
Private Sub btnVM_Click()
Dim S As String
Dim CN As String
CN = Nz(Me.Parent.CNotes, "")
Dim Symbol As String
Symbol = Chr(42)
Dim CD As Date
CD = Nz(Me.VMDate)
'Me.txtNote = S & "<div>&nbsp;" & CN
'&nbsp; = non breaking space
If CD = 0 Then
        Exit Sub
    Else: S = Symbol & CD ' & Chr(124)
        If IsNull(CN) Then
            CN = S
        Else: Me.Parent.CNotes = S & "<div>" & CN
        End If
    End If
Me.Parent.AddToNotes
End Sub
 

June7

AWF VIP
Local time
Today, 07:33
Joined
Mar 9, 2014
Messages
5,472
I wouldn't do this. I would have a related table for notes/comments and would probably use regular text field. I seldom use long text (memo) type field.

If you must have all notes in a single record, have you looked into the AppendOnly property of long text field? https://sourcedaddy.com/ms-access/append-only-fields.html
 

Users who are viewing this thread

Top Bottom