I have some code which occasionally errors (if someone makes a change in the DB whilst I am trying to read as our locking is set to table level rather than row level and I can't change this).
When it errors I hit debug and then hit continue and it continues on its merry way.
Is it possible on this error only to replicate my actions?
On Error Resume next
will skip over the erroring command and continue on, I don't want this, I want to continue with the command that gave the error as it usually works. However if the error is persistent then there could be a wider issue and we should stop.
I am thinking maybe an error trapping routine which then checks the error code and if it's a match it resumes (not Resume Next), if not then alert the user. Does this sound like the right way?
I have knocked this UNTESTED code up as I am not overly in bed with errors and error handling as I usually build my code to not error but in this case it is out of my control.
ErrHandler: If Err.Number = -2147467259 Then ErrorCount = ErrorCount + 1 'This is set to 0 at the start of the code If ErrorCount > 5 Then MsgBox "5 Rowfetch errors occured, could be a wider issue" End End If Resume End If Err.Raise 'I Think this is wrong, how do I raise an error as VBA normally would?