Without seeing your code, it's hard to accurately give advice. But, here's
some anyway.
When you use On Error GoTo... the error-handling portion should be at the
end of your function/subroutine. Typically, there's a statement label
before the handler to exit the function when there is no error (or after
your error-handler finishes handling the error) so the error-handler doesn't
accidentally execute. So, here's a very basic example:
Function InsertRecords()
Dim strSQL as String
strSQL="Insert whatever into whatever"
On Error Goto Err_Execute
CurrentDb.Execute strSQL, dbFailOnError
MsgBox "Insert successful"
Function_Exit:
Exit Function
Err_Execute:
MsgBox "Error executing the insert"
Resume Function_Exit
End Function
Hope this helps.