Export Report as csv format?

G

GEORGIA

is it possible to export report as csv format?

I've used output format as text but the file does not line up right.

My code loooks something like this.
DoCmd.OutputTo acOutputReport, "TEST_file", "Text Files
(*.txt;*.csv;*.tab;*.asc)", "C:\MyDocuments\test_" & Format(Date, "MMDDYYYY")
& ".csv"

I've used output format as Excel, however, the file may look csv file but it
is not.
File does need to be csv format or the program we use fails.

Thanks!
 
M

Marshall Barton

GEORGIA said:
is it possible to export report as csv format?

I've used output format as text but the file does not line up right.

My code loooks something like this.
DoCmd.OutputTo acOutputReport, "TEST_file", "Text Files
(*.txt;*.csv;*.tab;*.asc)", "C:\MyDocuments\test_" & Format(Date, "MMDDYYYY")
& ".csv"

I've used output format as Excel, however, the file may look csv file but it
is not.
File does need to be csv format or the program we use fails.


No way. A report is a graphic data presentation. They
won't even look good when printed to a text only printer,

Most needs are met by just exporting the report's record
source query. If that's not sufficent, then I suggest that
you write a procedure using the file I/O
statements/functions Open, Print, etc.
 
G

GEORGIA

I wish I can use the query to export it but I have to use the report.

Not familiar with I/O statements/functions, could you guide me?

Thanks again
 
M

Marshall Barton

Well, you can't use the report so you need to find another
way. Since a report is a formatted version of its record
source query, the query is the most logical place to start.

Using the file I/O statements/functions can be anywhere from
very simple to extremely complex depending on your
programming experience and how you want the resulting text
file to look.

If you want to try using File I/O, check VBA Help for:
Open Statement
FreeFile
Print # Statement
Close Statement
Spc Function
Tab Function

Then ask specific questions about how you can achive a
particular effect.
 

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