Solved

Access 2003, my txt file export is running backwards

Posted on 2016-08-31
4
62 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 500 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month7 days, 3 hours left to enroll

623 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