No error on docmd.transfertext when expected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
Back
Top