Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error during export thru VBA

Posted on 2006-11-29
3
Medium Priority
?
295 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 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
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…

730 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