Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy a table to a folder in Txt Format

Posted on 2013-01-25
9
Medium Priority
?
300 Views
Last Modified: 2013-02-02
I need to copy a table to a folder.  The format will be in Txt Format.  VBA code with delimitors of commas.
0
Comment
Question by:Startrac98
  • 3
  • 3
  • 3
9 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 38818977
DoCmd.TransferText acExportDelim, , "Source Table or Query Name", "C:\folder\destination_file_name.txt"
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38819101
you will need Export Specification to do that


1.right click on the table
2.select export > Text file
   click on Browse and locate the destination folder
3. (you can accept the proposed name or change it)
click Save, then click OK
4. In the export text wizard select the type (Delim Fixed) width
5. Follow the wizard, before clicking on Finish
     5a .Click Advanced
6. In the Export Specification dialog box Field Information List, correct any descrepancies

7. click save as, give the specification a name <-- this is the specification name that you will use in the command line below


DoCmd.TransferText acExportDelim, "ExportSpecName", "TableName", "C:\myCsv.csv", True
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38819137
Actually the above answer is not correct.   Export Specifications to enable the developer to define many properties of an export, but it is not a requirement to export a table or query to a file.

acExportDelim has as a default commas as delimeters.

So ... my answer is correct based on how the question was asked.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:Startrac98
ID: 38830870
I have a concern with saving the specifications and using the Wizard.  If I want to copy the DB for other users to use on their PC's the saved specifications are not copied over.  That is why I think I have to write VBA code and not use the Wizard.  Unless there is a better way can you help with the VBA Code?  Thanks
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38830888
< If I want to copy the DB for other users to use on their PC's the saved specifications are not copied over.>

this is not true, the Specification are saved in an "Msys"  table and this table moves with the database.
0
 

Author Comment

by:Startrac98
ID: 38831116
ok, I'll check this out but I have had issues.  Is there any special settings or is this standard?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38831127
<Is there any special settings or is this standard? > 
if you mean the "spec" saved in a table, YES this is standard
0
 

Author Closing Comment

by:Startrac98
ID: 38846488
This code worked fine and was very helpful.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38846868
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

972 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