Share via

Exporting data containing CrLf

AlphonseG 236 Reputation points
2022-03-14T12:48:30.863+00:00

I export query (built on-the-fly) data to a text file using DoCmd.TransferText acExportDelim.
Some fields contain CrLf.
When imported into Excel, each CrLf is considered a new row (even though the field data is wrapped in quotes), so the import is basically a mess.
I've tried replacing CrLf with Lf (or Cr), however, it seems that DoCmd.TransferText exports CrLf anyway.
Any ideas for a workaround?

Microsoft 365 and Office | Access | Development
0 comments No comments

1 answer

Sort by: Most helpful
  1. Olaf Helper 47,621 Reputation points
    2022-03-14T13:00:29.817+00:00

    Some clients like MS Excel support Cr-Lf within data, but only when you enclose it with quotation marks, like here "Test4 CrLf Test5"

    Test1;Test2
    Test3;"Test4
    Test5"
    

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.