How do i stop a carraige return from being inclued in export file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Quizzed
    New Member
    • Jan 2009
    • 33

    How do i stop a carraige return from being inclued in export file?

    Can any one advise on the following please;

    I am exporting a table of data into a CSV file from a MS Access 97 Db. An extract of the export routine used is below;

    Code:
    DoCmd.TransferText acExportDelim, "EXPORT_MobileSpec", "qryEXPMessageCUSTMobile", "\\server_id\C$\FolderName\FileName.csv"
    The resulting file has a carraige return on the very last record of data, so if i have 5 lines of data exported, the file actually contains 6 lines.

    Appreciate any advice, tks.
    Last edited by NeoPa; Dec 9 '11, 05:24 PM. Reason: Fixed [ CODE ] tags
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That shouldn't cause any problems. Is the last carriage return causing a problem?

    Comment

    • Quizzed
      New Member
      • Jan 2009
      • 33

      #3
      Hi Rabbit,
      The exported file is being processed by another application and because there is an additional blank line at the end of the file, it produces an error. Question is, how can i stop the carraige return being applied at the end of the last record of data? Cheers.

      Comment

      • Mihail
        Contributor
        • Apr 2011
        • 759

        #4
        Just an idea:
        Reopen the file (after transfer) and remove last character(s).

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32634

          #5
          If there is only one carriage return at the end of the file then that is how it should be.

          If there is more than one then this would indicate you have a blank line in the data you're exporting.

          If the former is true, then the software that is interpreting this file is either doing a poor job (and should itself be fixed) or it has configuration options that are set incorrectly (so should be reconfigured).

          Mihail has given a suggestion that allows you to compensate for either of the other problems (with your data or the other software) but you should always appreciate where the problem lies. Personally i'd want to fix the actual problem if at all possible, before I looked at ways of getting around it.

          Comment

          • Quizzed
            New Member
            • Jan 2009
            • 33

            #6
            Tks NeoPa & Mihali - Yes there is only the one CR at the end of the file, i'll talk to the vendor of the other application. if they can't fix it then i'll go with the suggestion.

            Comment

            Working...