Write Text file from Access w/out Carriage Return

G

Guest

Need to write text file output from Access 2007 without Carriage Return.
Specs for file I need to create require only a line feed. Chr(10) Hex '0A'.
Access automatically creates Carriage Return and Line Feed Hex '0D0A'
 
J

John Nurick

Hi Bill,

This can't be done with the built-in export routine. One approach
would be to export the file normally (0d0a), then remove the CRs.

There are quite a few utility programs that will do this: a web search
for
dos2unix
will find some.

Otherwise it's a matter of writing VBA code to create the text file.
You can use the old Basic Print # statement with a semicolon to
suppress the normal line break, e.g.

Dim lngOut As Long
lngOut = FreeFile()
Open "D:\folder\file.txt" For Output as #lngFN
Print #lngFN, "First Line" & Chr(10);
Print #lngFN, "Last Line" & Chr(10);
Close #lngFN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top