Solved

Access 2010 Export Table to current location

Posted on 2012-04-02
11
312 Views
Last Modified: 2012-04-02
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.
0
Comment
Question by:JAMES125
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 17

Expert Comment

by:ramrom
ID: 37796444
More info please.
What is "a database"
What is "the table"?
How would you discover the new location?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 37796458
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
0
 

Author Comment

by:JAMES125
ID: 37796598
I tried the following but nothing happens

 DoCmd.TransferText acExport, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 37796641
did you look at the folder where your database is ?

type this in the Immediate window from the VBA code window

?CurrentProject.Path

that should give you the path of the db you are working on..
0
 

Author Comment

by:JAMES125
ID: 37796709
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?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 119

Expert Comment

by:Rey Obrero
ID: 37796728
did you check if the "ExportSpec" is correct for your "export query"?
0
 

Author Comment

by:JAMES125
ID: 37796729
This was the final solution:

 DoCmd.TransferText acExportFixed, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
0
 

Author Closing Comment

by:JAMES125
ID: 37796735
Final Solution:

 DoCmd.TransferText acExportFixed, "ExportSpec", "Export Query", CurrentProject.Path & "\test.txt"
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 37796739
JAMES125,

The Export Specification is NOT the same as the Saved Exports steps.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37796801
1.
Does this work if you export the query to text from the Navigation pane?
(Right click the query, and select "Export")\

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


...double check your Export Spec...
0
 
LVL 17

Expert Comment

by:ramrom
ID: 37796834
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.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now