Results 1 to 2 of 2

Thread: [RESOLVED] Display Text with vbcrlf in them

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    11

    Resolved [RESOLVED] Display Text with vbcrlf in them

    I've created a function that will loop round records in a recordset and bring me back the data i want to display.

    The function is

    Public Function LoadHistory(ByRef lngProject As Long) As String

    Dim rsHistory As New ADODB.Recordset
    'Set rsProject = GetRecordset(strSQL)
    Set rsHistory = GetRecordset("select * from t_ProjectHistory where projectid = " & lngProject)
    Dim sSql As String
    'sSql = "========================" & vbCrLf
    With rsHistory
    If Not .EOF Then
    .MoveFirst
    Do Until .EOF
    sSql = sSql & "On " & .Fields("HistoryDate") & " " & Trim(.Fields("HistoryUser")) & " wrote : " & vbCrLf & .Fields("Comments") & vbCrLf
    sSql = sSql & "=================================================" & vbCrLf
    .MoveNext
    Loop
    End If
    End With


    LoadHistory = sSql

    rsHistory.Close
    Set rsHistory = Nothing

    End Function

    later when i call that funtion I want to display the results in one text box, like this

    frm_Main.txtComments = LoadHistory(.Fields("Projectid"))

    This works, and does give me the result back, but not the carradge returns and lines feeds, instead of getting back this

    On 05/11/2007 debbie.coates wrote :
    Comment One
    =================================================
    On 05/11/2007 debbie.coates wrote :
    Comment Two
    =================================================

    i get this

    On 05/11/2007 debbie.coates wrote : ||tHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG||=================================================||On 05/11/2007 debbie.coates wrote :
    tHE CAT IN THE HAT

    so the text is all on one line. does anyone know why this is?

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    11

    Re: [RESOLVED] Display Text with vbcrlf in them

    Actually I've sorted it, it was becasue i didn't have the multi line propertiy of the text box set to True.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width