Dear My Friends,

I wish to ask a question about updating data in a MS Access database which I use ADO for connecting.

Suppose my program allows the use to import data from a delimited text datafile and the primary key of the database is

stockcode;date

If the user click the import button twice, the error (-2147467259) will occur:

"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."

So I wish to trap this error and prompt the user whether to overwrite the existing data item or cancel the insertion. I also wish to provide a checkbox "ALL" to allow the user to overwrite all data or just keep all existing data unchanged.

So can anyone give me some coding hints on how I can achieve this purpose. Thanks a lot.