fearoffours
Registered User.
- Local time
- Today, 15:33
- Joined
- Apr 10, 2008
- Messages
- 82
Well, I'm sure it's not that strange, and merely just that in all tghe cutting and pasting of other peoples example code I have somewhere along the lines managed to make a small error in my coding!
I have a memo field "Notes" on a form. I want every new line in this field to be preceded by a by a bullet point. So far I have the following code in After Update:
It's nearly doing what i want; but it's replacing the entire first line with a bullet point. It does seem to be the For Next loop thats the problem, as removing this inserts a bullet at the start of the first line as expected.
Anyone help? (And thanks to all the help I've already found through searching the forums over the last few days!)
I have a memo field "Notes" on a form. I want every new line in this field to be preceded by a by a bullet point. So far I have the following code in After Update:
Code:
Private Sub Notes_AfterUpdate()
Dim sNotes As String
Dim sEolPos As String
Dim X As Integer
Dim NewLines As Integer
sNotes = Notes.Value
NewLines = StrCount(sNotes, vbCrLf)
For X = 1 To NewLines
sEolPos = InStr(sNotes, vbCrLf)
If Mid(sNotes, sEolPos + 2, 1) <> "•" Then
sNotes = Replace(sNotes, vbCrLf, vbCrLf & "• ", sEolPos)
End If
Next
If Left(sNotes, 1) <> "•" Then
sNotes = "• " & sNotes
End If
Notes.Value = sNotes
End Sub
Anyone help? (And thanks to all the help I've already found through searching the forums over the last few days!)
Last edited: