Solved

Access 2010 Export Table to current location

Posted on 2012-04-02
11
315 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

860 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