Is there a way to get the first 2 lines of a memo field? The lines would be split by a hard return.
Microsoft Access
Last Comment
Patrick Matthews
8/22/2022 - Mon
danishani
Try to use the InStr() function together with Chr(13), something like:
InStr(1,[YourMemoField], Chr(13))
HTH,
Daniel
error_prone
ASKER
This just gives me a number and not the string on the first and second lines.
Hamed Nasr
Try this: memo field: rt
Private Sub Command8_Click()
Dim s As String ' string to hold memo text
s = Me.rt 'memo field
Dim x As Variant ' array to hold lines of text
x = Split(s, Chr(13) & Chr(10))
Dim l1 As String 'line 1
Dim l2 As String
l1 = Replace(x(0), Chr(13) & Chr(10), "")
l2 = Replace(x(1), Chr(13) & Chr(10), "")
End Sub
InStr(1,[YourMemoField], Chr(13))
HTH,
Daniel