Access 2010 Export Table to current location

I have a database that changes locations regulary.  I would like to have a button to export the table to the database's current location.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramromconsultant Commented:
More info please.
What is "a database"
What is "the table"?
How would you discover the new location?
Rey Obrero (Capricorn1)Commented:
use this command

docmd.transferdatabase acexport, ' < to export the table to another database

docmd.transferspreadsheet acexport , ' < to export the table to excel

docmd.transfertext acexport , ' < to export the table to a text file

you will use

CurrentProject.path  ' to get the folder where your current database is running from

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JAMES125Author Commented:
I tried the following but nothing happens

 DoCmd.TransferText acExport, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Rey Obrero (Capricorn1)Commented:
did you look at the folder where your database is ?

type this in the Immediate window from the VBA code window


that should give you the path of the db you are working on..
JAMES125Author Commented:
The path is showing correctly when I debug.  When I click the button it appears to process the export but when I open the file nothing is there.  I verified that the query I'm exporting is full of records.  Any ideas?
Rey Obrero (Capricorn1)Commented:
did you check if the "ExportSpec" is correct for your "export query"?
JAMES125Author Commented:
This was the final solution:

 DoCmd.TransferText acExportFixed, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
JAMES125Author Commented:
Final Solution:

 DoCmd.TransferText acExportFixed, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
Rey Obrero (Capricorn1)Commented:

The Export Specification is NOT the same as the Saved Exports steps.
Jeffrey CoachmanMIS LiasonCommented:
Does this work if you export the query to text from the Navigation pane?
(Right click the query, and select "Export")\

Does this work?
DoCmd.OutputTo acOutputQuery, "Export Query", acFormatTXT, CurrentProject.Path & "\test.txt"

...double check your Export Spec...
ramromconsultant Commented:
JAMES125: I'm glad you got what you wanted. I recommend in future asking "better questions" so we don't have to make stabs in the dark.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.