title: How do I tell VBA code to try again on a specific error?
body: <p>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).</p>
  
  <p>When it errors I hit debug and then hit continue and it continues on its merry way.</p>
  
  <p>Is it possible on this error only to replicate my actions?</p>
  
  <pre><code>On Error Resume next
  </code></pre>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <pre><code>ErrHandler:
  If Err.Number = -2147467259 Then
      ErrorCount = ErrorCount + 1 'This is set to 0 at the start of the code
      If ErrorCount &gt; 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?
  </code></pre>