Docmd.RunSql problem

M

Mohammad

I am using DoComd.Runsql to insert rows in a table. There
are some rows not inserted because of key vaulation error.
How can I know if the rows are inserted succeffully or not?
I tried to use Error catching using On Error statement,
but it does not catch the error.
Please, send me the response on e-mail:
[email protected]
 
B

Brian

Mohammad said:
I am using DoComd.Runsql to insert rows in a table. There
are some rows not inserted because of key vaulation error.
How can I know if the rows are inserted succeffully or not?
I tried to use Error catching using On Error statement,
but it does not catch the error.
Please, send me the response on e-mail:
[email protected]

If using DAO:

CurrentDb.Execute "INSERT blah blah blah", dbFailOnError

You will then be able to trap the error. If using ADO, I imagine it's
probably something like CurrentProject.Connection.Execute instead of
CurrentDb.Execute
 
Top