Solved

Access 2010 Export Table to current location

Posted on 2012-04-02
11
314 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

832 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