macro to export table to .txt file revisited

D

DChitwood

Last week I posted this question:
I've figured out how to create a macro that will export a
table to a .txt file using a static file name. However, I
need for the resulting .txt file to be different every
time. This macro will be used by a person whose ability
is pretty much limited to point, click, and fill in a pop-
up box or two. How can I write the macro so that it
prompts the user for a file name to which the table should
be exported?

Ken Snell kindly provided this answer:
DoCmd.TransferText acExportDelim, "Specification
Name", "TableQueryName", _
"PathToExportedFile" & InputBox("Enter the name of the
text ("".txt"")
file to be created:" _
,"Enter File Name") & ".txt"

I think I've put everything into the Create Macro boxes
properly. However, when I run it, I get an error
message: "Cannot update. Database or object is read-
only." The table that I am attempting to export is set to
View:Datasheet and DataMode:Edit. Any clue as to what
I've done wrong or should do differently?
 
J

Jim/Chris

In the output file name in hte macro put
=InputBox("Enter the full name and path of the file to be
saved:")

or

=InputBox("Enter the name and path of the text file to be
saved:"&".txt")



Jim
 
J

Jim/Chris

Sorry The second one should be
=InputBox("Enter the name and path of the text file to be
saved:")&".txt"


Jim
 
G

Guest

Jim - Thanks. But I still get the same error code. Must
be something in my table setup?
 

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