Hi,

question:

I would like to catch and handle this error (on Error doesn't catch this type of error)

How can I catch this error?

more details:

I'm running a function that inserts records into a table .

while something

mySerial = DMax("serial", "myTable") + 1
sqlstr = " INSERT INTO myTable ( serial SELECT " & mySerial & "; " )
docmd.runsql sqlstr

wend

On same cases the function halts on "ms access cant append all the records due to key violations".

Checking this further reveals that the that serial generated is already occupied - probably in the case where another user created a new record between generating mySerial to the point where actually runsql tried to commit the new record insert (?)