Solved

Error during export thru VBA

Posted on 2006-11-29
3
291 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

739 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