A2003 report to CSV file

  • Thread starter Thread starter tony
  • Start date Start date
T

tony

I'm trying to allow a user to generate a report that is a CSV file to import
to a telephone dialing system for member notifications. I have it working
using a report that has the fields with the delimeters like
" filed1 "," field2 "," field3 "

I use a "docmd.outputo" to run the report and put it out to a Call.CSV file

It works but ever few line a blank line is inserted with just a CR/LF. It
seems to be some type of maximum length because I can cause the blank lines
every third line with a font size of 10 and every fourth line with a font
size of 8?

Any help is greatly appreciated.
Tony
 
tony said:
I'm trying to allow a user to generate a report that is a CSV file to import
to a telephone dialing system for member notifications. I have it working
using a report that has the fields with the delimeters like
" filed1 "," field2 "," field3 "

I use a "docmd.outputo" to run the report and put it out to a Call.CSV file

It works but ever few line a blank line is inserted with just a CR/LF. It
seems to be some type of maximum length because I can cause the blank lines
every third line with a font size of 10 and every fourth line with a font
size of 8?


A report is a graphics print kind of file. If you want it
as straight text, you should create a query with the data
and export the query.
 
This is a retirement area social club using the software. I have to make
this a button push. The other software looks for a specific file name with a
"CSV" extension sp ot os a button push also.

If there is a way to use a query to programmatically create the CSV fils, I
can do that. I know how to do a report, I have no idea how to use a query to
do the same thing.

I still don't understand whay the blank lines are inserted with the way I'm
doing it since there is a CR/LF after each line of text. Is this a A2003 bug
or a printer driver error or???
 
The blank lines are caused by the spacing of the data in the
report. No matter how much effort you put into trying to
make the report spacing match up with a text file's idea of
a line there will be little rounding errors that will
eventually add up to a blank line. Font sizes, etc will
also be a factor when converting binary graphics stuff to a
text file. Bottom line is that reports are just not made to
be exported as anything other than a print graphics print
file.

If you can create a query that contains the desired data,
then you can use the TransferText method (see VBA Help for
details) to export the query to a text file. Once you get
the details worked out, it's really pretty straightforward.

If you hit a blind spot, post back with the details and
we'll try to work our way through it.
 
THANKS. Took a bit of learning but I got it to work in A2003 & A2007.

Thanks for the help!

Problem solved!

Marshall Barton said:
The blank lines are caused by the spacing of the data in the
report. No matter how much effort you put into trying to
make the report spacing match up with a text file's idea of
a line there will be little rounding errors that will
eventually add up to a blank line. Font sizes, etc will
also be a factor when converting binary graphics stuff to a
text file. Bottom line is that reports are just not made to
be exported as anything other than a print graphics print
file.

If you can create a query that contains the desired data,
then you can use the TransferText method (see VBA Help for
details) to export the query to a text file. Once you get
the details worked out, it's really pretty straightforward.

If you hit a blind spot, post back with the details and
we'll try to work our way through it.
--
Marsh
MVP [MS Access]

This is a retirement area social club using the software. I have to make
this a button push. The other software looks for a specific file name with a
"CSV" extension sp ot os a button push also.

If there is a way to use a query to programmatically create the CSV fils, I
can do that. I know how to do a report, I have no idea how to use a query to
do the same thing.

I still don't understand whay the blank lines are inserted with the way I'm
doing it since there is a CR/LF after each line of text. Is this a A2003 bug
or a printer driver error or???
 
Back
Top