Link to home
Create AccountLog in
Avatar of sf_garrison
sf_garrisonFlag for United States of America

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???
Avatar of silemone
silemone
Flag of United States of America image

what is the new line character:  \r\n  or\n?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of sf_garrison

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
Quick Response Thanks!