Solved

Error during export thru VBA

Posted on 2006-11-29
3
287 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
  • 2
3 Comments
 
LVL 34

Expert Comment

by:jefftwilley
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now