sf_garrison
asked on
Check if first character in text box (memo field) is a new line character
I have a memo field that hold comments about a record. They however like each new comment that is added to be at the beginning (top) not the end. What I would like to do is when the textbox gets the focus check and see if the first character is already a new line character, if not, I want to insert a new line character so when the user starts typing the text that is already there is moved down a line, and they are typing a new line at the top of the box. Make sense???
what is the new line character: \r\n or\n?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks capricorn, I was having a brain fart!!! Below accomplishes exactly what I want to do
Private Sub JobComments_GotFocus()
If Left(Me.JobComments, 1) <> vbCr And Left(Me.JobComments, 1) <> vbLf Then
Me.JobComments.SelStart = 0
SendKeys "{Enter}"
SendKeys "{up}"
End If
End Sub
Private Sub JobComments_GotFocus()
If Left(Me.JobComments, 1) <> vbCr And Left(Me.JobComments, 1) <> vbLf Then
Me.JobComments.SelStart = 0
SendKeys "{Enter}"
SendKeys "{up}"
End If
End Sub
ASKER
Quick Response Thanks!