• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Copy a table to a folder in Txt Format

I need to copy a table to a folder.  The format will be in Txt Format.  VBA code with delimitors of commas.
0
Startrac98
Asked:
Startrac98
  • 3
  • 3
  • 3
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
DoCmd.TransferText acExportDelim, , "Source Table or Query Name", "C:\folder\destination_file_name.txt"
0
 
Rey Obrero (Capricorn1)Commented:
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
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Startrac98Author Commented:
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
 
Rey Obrero (Capricorn1)Commented:
< 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
 
Startrac98Author Commented:
ok, I'll check this out but I have had issues.  Is there any special settings or is this standard?
0
 
Rey Obrero (Capricorn1)Commented:
<Is there any special settings or is this standard? > 
if you mean the "spec" saved in a table, YES this is standard
0
 
Startrac98Author Commented:
This code worked fine and was very helpful.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the grade.  Good luck with your project.  -Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now