?
Solved

Access 2003, my txt file export is running backwards

Posted on 2016-08-31
4
Medium Priority
?
65 Views
Last Modified: 2016-08-31
I am trying to export a table into a txt file, tab delim. I have the export spec built. When I run the code below, the existing data from the destination file gets inserted into the table. In other words, it's running completely backwards:

Private Sub cmdGetInventoryData_Click()

txtExportName = "C:\AmazonFeeds\data.txt"

DoCmd.TransferText acExportDelimited, "AmazonInventoryCreateData", "Data2", txtExportName

End Sub

Open in new window

0
Comment
Question by:QMBB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:TechieMD
ID: 41778933
I believe acExportDelimited isn't a valid TransferType, and as such, is reverting to the default of acImportDelim.

Try acExportDelim instead of acExportDelimited:

Private Sub cmdGetInventoryData_Click()

txtExportName = "C:\AmazonFeeds\data.txt"

DoCmd.TransferText acExportDelim, "AmazonInventoryCreateData", "Data2", txtExportName

End Sub

Open in new window

0
 

Author Comment

by:QMBB
ID: 41778944
Derp. That was it.

BUT I found another problem... the exported data does not include the field names, and I need it to. I double checked the Saved Spec, even recreated it making sure the box was checked, but the written output is only showing me the records. Ideas?
0
 
LVL 5

Accepted Solution

by:
TechieMD earned 2000 total points
ID: 41778954
For that, we just add True for the next parameter (which is HasFieldNames):
Private Sub cmdGetInventoryData_Click()

txtExportName = "C:\AmazonFeeds\data.txt"

DoCmd.TransferText acExportDelim, "AmazonInventoryCreateData", "Data2", txtExportName, True

End Sub

Open in new window

0
 

Author Comment

by:QMBB
ID: 41778957
Niiiice... thanks much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

719 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