Error statement for ADO

L

Lucky

I need to create an error handler for and ADO
connection. Data is appended periodically from one db
(no primary key) to Access db table and duplicate values
may occasionally occur during this update.

When it occurs, the following error message shows:
"The changes you requested to the table were not
successful because they would create duplicate values in
the index, primary key, or relationship. Change ...etc."

I need to write a code to trap these duplicate values and
update just valid values. I have created the following
statement. It prevents the code from breaking, but if
duplicate values exist no values are appended to the
table:

ErrorHandler:

If cnn.Errors.Count > 0 Then
For Each err In cnn.Errors
cnn.Errors.Clear
Next err
End If
Resume Next

Any suggestions are greatly appreciated.

Thank you.

Lucky
 

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