Solved

Access 2010 Export Table to current location

Posted on 2012-04-02
11
313 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

911 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

17 Experts available now in Live!

Get 1:1 Help Now