Deleting Unnecessary Lines

G

Guest

Thanks in Advance

Below is my small procedure that runs a query named as "Test" and puts the
query result into a destination path with a date appeneded at the end of file
named asTimeStamp. The output has unnecessary lines and unwanted headings,
shown below.

------------------------------------------------------------------
Code | Start Time | Duration |
-----------------------------------------------------------------------
| 00 | 0805 | 0857 |
-----------------------------------------------------------------------
| 00 | 0818 | 0858 |
-----------------------------------------------------------------------
(Help) How can I delete headings and unnecessary lines with only comma as a
record delimiter.
In short, I want to achieve the following format.

00,0805,0857
00,0818,0858

(Code)
Dim Qry_Regular As String
Dim Path As String

Qry_Regular = "Test"
Path = "C:\\...\TimeStamp" & Format(Date, "mmm-dd-yyyy") & ".txt"

DoCmd.OutputTo acOutputQuery, Qry_CPLYT_Regular, acFormatTXT, Path
 
J

John Vinson

Dim Qry_Regular As String
Dim Path As String

Qry_Regular = "Test"
Path = "C:\\...\TimeStamp" & Format(Date, "mmm-dd-yyyy") & ".txt"

DoCmd.OutputTo acOutputQuery, Qry_CPLYT_Regular, acFormatTXT, Path

Rather than using the OutputTo method - which outputs a
print-formatted file, with the lines and headers - use File... Export.
Choose the .txt file option and use the Export Wizard to set up a
comma delimited output file.

John W. Vinson[MVP]
 
N

Nikos Yannacopoulos

Jay,

Use TransferText instead of OutputTo. You may need to create an export
specification in order to manipulate the output (e.g. drop the quotes as
text qualifiers). To do so, do the export manually once, save the export
spec that is created and note its name; you can then use it in your code.

HTH,
Nikos
 

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