Exporting to a .txt file

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I'm using Access 97. I'm trying to export a table to
a .txt file and getting an error message. It doesn't like
the "text(*.txt)" line in the following statement:

DoCmd.OutputTo , "MyTable", "text(*.txt)", , False

What I like about the 'OutputTo' method is that Excel will
prompt the user with a 'Save As' dialog box so the user
can decide what to name the file and where to save it. I
don't think the "TransferText" method allows this, or does
it??

Thanks.
 
If you look in Help you'll find that the OutputFormat parameter is an
AcFormat constant, not a string description. Use AcFormatText. If you
omit the filename you'll get a Save As dialog.

But OutputTo has limitations compared with TransferText. Yes, you have
to pass the latter a filename; but you can use the code at
http://www.mvps.org/access/api/api0001.htm to display the File Save
dialog and get the filename from the user.
 
Back
Top