Solved

Error during export thru VBA

Posted on 2006-11-29
3
290 Views
Last Modified: 2006-11-29
Hi: when i try to export data into textfile thru VBA it gives a message. But same thing if i go to the table and right click
and export there is no error. My question is why it gives me that error when i try to export thru VBA code?

Microsoft Access was unable to append all the data to the table.
The contents of fields in 1 record(s) were deleted, and 0 records were lost due to key violations. If data was deleted, the
data you pasted or imported doesn't match the field data type or the FieldSize property in the destination table.
If records were lost, either the records you pasted contain primary key values that already exist in the destination table,
or they violate referential integrity rules for relationship defined between tables.
Do you want to proceed any way?

DoCmd.TransferText acExportDelim, , "Qry_AlltblCustomersExport", "C:\MailSave\KDB_tblCustomers.txt"

Qry_AlltblCustomersExport
-------------------------
SELECT tblCustomers_Export.FormCode, tblCustomers_Export.Corp, tblCustomers_Export.House, tblCustomers_Export.Cust,
tblCustomers_Export.Name, tblCustomers_Export.Street, Left([CityStateZip],InStr([CityStateZip],",")-4) AS City,
Mid([CityStateZip],InStr([CityStateZip],",")-2,2) AS State, Trim(Mid([CityStateZip],InStr([CityStateZip],",")+1)) AS Zip
FROM tblCustomers_Export;

Thanks.
0
Comment
Question by:mustish1
[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
3 Comments
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18036782
M,
You should not get append errors with an export

DoCmd.TransferText acExportDelim, "", Qry_AlltblCustomersExport", "C:\MailSave\KDB_tblCustomers.txt", False, ""
0
 

Author Comment

by:mustish1
ID: 18036875
I try it but it gives same error
DoCmd.TransferText acExportDelim, "", "Qry_AlltblCustomersExport", "C:\MailSave\KDB_tblCustomers.txt", False, ""
0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 500 total points
ID: 18036976
If the code you're using is part of a larger function, or series of them, then there is a problem somewhere else. You're not running an append query...yours is select.
If you step through the code, is the part you're pasting in where it fails?
J
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mimic UNC drive 10 47
MS Access Subform Unique Records Issue 14 35
MS Access Query Question 2 34
What can I do to shrink my Access Frontend? 12 45
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 …

740 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