Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VBA (Access) On close event adds carriage return

Options
  • 05-07-2006 9:49am
    #1
    Closed Accounts Posts: 2,268 ✭✭✭


    Hello all,
    I am capturing a data stream as text and then PRINT ing to a text file.
    However when I open the text file (after it has been filled with data) it contains an additional carriage return. Does anyone know why?

    I have included the code. Has anyone encountered this issue in the past?

    MM

    GetNewFileName is a function that sets the name for the new file.
    Private Function Example (ByRef strFileName As String) As String
        Dim intInFile As Integer
        Dim intOutFile As Integer
        Dim strFileData As String
        ' Create the output filename
        strOutFileName = GetNewFileName(strFileName)
        strOutFileName = Left(strOutFileName, Len(strOutFileName) - 4) & ".txt"
    
        ' Write the streamed file data to the output file
        intOutFile = FreeFile
        Open (strOutFileName) For Output As #intOutFile
        Print #intOutFile, strFileData
        Stop
        'At this point there is no additional line
        Close #intOutFile
        'At this point there is an additional line
    End Function
    


Comments

  • Closed Accounts Posts: 82 ✭✭cyberbob


    according to google :rolleyes: you just do this
    print #whatever, expr ;

    print puts the CR there by default. the semicolon stops this (well it did on my machine)


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    anyhoo I trimmed the string by 1


Advertisement