I need help passing vbLF in a string to a textbox control in ACCESS 2010.

Hi Experts,
I have the following VBA code where I use vbLF in a string in my ACCESS application.  When I pass the string with the vbLF to my textbox control, the data is put in a single line.  There is no carriage return or line feed that occurs. How can I fix this?

See my code below
Private Sub viewEmail(strValues As String)
On Error GoTo ErrorHandler
         Dim rs2 As DAO.Recordset
         Dim db2 As Database
         Dim strSQL2 As String
         Dim strPassedValue As String
         Dim intJobId As Integer
         Dim strTech As String
         Dim varVals As Variant
         Dim strEmailMessage As String
         strPassedValue = strValues 'Me.OpenArgs
         varVals = Split(strPassedValue, "/")
         intJobId = CInt(Trim(varVals(0)))
         strTech = Trim(varVals(1))
         Set db2 = CurrentDb
         strSQL2 = "SELECT * FROM Schedule_Table WHERE JobID = " & intJobId & " AND Tech_Name = '" & strTech & "'"
         Set rs2 = db2.OpenRecordset(strSQL2)
          If rs2.RecordCount > 0 Then
            strEmailMessage = rs2![JobName] & vbLf
            strEmailMessage = strEmailMessage & rs2![VenueName] & vbLf
            strEmailMessage = strEmailMessage & rs2![AreaName] & vbLf
            MsgBox ("There was an issue generating the email text.")
          End If
        Me.txtEmailBody.Value = strEmailMessage

'    Set rsScheduled = Nothing
    Exit Sub
    MsgBox "Error No: " & Err.Number _
       & " in " & Me.ActiveControl.name & " procedure; " _
       & "Description: " & Err.Description
    Resume ExitSub
End Sub

Open in new window

thanks in advance,
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A textbox won't allow CR's from the helpfile:
Up to 63,999 characters. (If the Memo field is manipulated through DAO and only text and numbers [not binary data] will be stored in it, then the size of the Memo field is limited by the size of the database.)
So to show this use a rich text control from the Active X controls.
Gustav BrockCIOCommented:
You have to use vbCrLf or vbNewLine, not vbLf.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Or you can use:
strEmailMessage = rs2![JobName] & Chr(13) & Chr(10)

"A textbox won't allow CR's from the helpfile:"
Sorry, but that's not true.  You can most definitely enter a LFCR in a Text Box.
And on the Property Sheet of a Text Box, you can set Enter Key Behavior to "New Line in Field"


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.