Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA results different from manual results 1

Status
Not open for further replies.

FunGuy

MIS
Sep 15, 1999
36
US
When I do a OutputTo, the results are different compared to the manual method of exporting a query.  When I do it in VBA, I get a bunch of apparent formatting code in the saved file though I tell it to save it as a txt file; and it is a lot larger than it should be.  When I do the same thing manually using File/Export and use the Export wizard, it works as expected and the text file is as it should be.  Any thoughts on why there is this difference?
 
File/Export saves it as a text file.&nbsp;&nbsp;OutputTo outputs to a printer.&nbsp;&nbsp;If you tell it to OutputTo a text file, it will output the printer output to a text file for later printing - this includes all the formatting codes the printer needs.<br><br>Define a generic text-only printer (in Windows) that doesn't use any formatting codes and OutputTo <b>that</b> printer.
 
If you are trying to export a file, use the TransferText method instead of the Output to.<br><br>You will need to export once manually, creating an Export Specification, then in the TransferText method you can specify:<br><br>Whether it is Import or Export<br>Whether it is Fixed Width or Delimited<br>Which File to export to<br>Which Query (or table) you are exporting<br>The Export Specification you will use.<br><br>Just put the code on the OnClick of a button. <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
Thanks.&nbsp;&nbsp;Your ideas worked.&nbsp;&nbsp;Too bad the Access documentation is so misleading on this issue.&nbsp;&nbsp;No where in the Help does it say anything about printing with OutputTo.&nbsp;&nbsp;But it does say you can use it to export to a text file.&nbsp;&nbsp;But TransferText works as I was shooting for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top