Exporting to a .txt file

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.
 
J

John Nurick

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.
 

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