No error on docmd.transfertext when expected

E

ES

I am using the docmd.transfertext command to load a csv file into my
database.

DoCmd.TransferText acImportDelim, "CsvImpSpec", strTable, strFile, False

The file I am loading has 4 records that violate the primary keys in the
table.

The TransferText command is just skipping these records and is not showing
an error. In the past if a record did not fit the field properties
TransferText would create an error table. Is there a way to catch the error
and identify the records or do I need to remove the primary keys | import the
data | ID bad data | fix records | reset the keys?

Any thoughts would be appreciated.
 
J

John Nurick

I've never understood the circumstances in which Access does and does
not create an ImportErrors table, and what I've found about it on the
Microsoft website doesn't make it any clearer.

If you want to be sure you are in control of what's happening, link to
the text file instead of importing it. Then you can run various queries
aginst the linked table and the database table, e.g. a "Find duplicates"
query to discover if any of the primary key values in the file already
exist in the database and an append query to import the records you
want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top