Unfortunately there is no try catch block in VB6... You have to go back to the good old fashioned On Error
Do you want to handle the error in your code? or are you trying to figure out where it occurred?
If you're handling in the code you have two choices:
'Example of sub routine with GOTO
On Error Goto Err_Handler
'..... do what ever
'What do you want to do with the Error?
'Example of sub routine with resume next
On Error Resume Next
'Doing something that could lead to an error
if Err.Number <> 0 then
The On Error Goto Option means that if there is an error go directly to the marked line of code. In the example I've done if there is an error anywhere in the sub routine then the code jumps down into my error handler if not, it will hit the line Exit sub beforehand and not go in.
The On Error Resume Next means exactly that, if there is an error, carry on to the next line of code. In my example I trap and handle the error on the next line.
If you are trying to figure out where it happens, you need to put brek points in your code and step through it.
As an educated guess, I'd say the code is trying to insert a record into a database table with a primary Key value that is already in use rather than an update.