How do I tell VBA code to try again on a specific error? -
i have code errors (if makes change in db whilst trying read our locking set table level rather row level , can't change this).
when errors hit debug , hit continue , continues on merry way.
is possible on error replicate actions?
on error resume next
will skip on erroring command , continue on, don't want this, want continue command gave error works. if error persistent there wider issue , should stop.
i thinking maybe error trapping routine checks error code , if it's match resumes (not resume next), if not alert user. sound right way?
i have knocked untested code not overly in bed errors , error handling build code not error in case out of control.
errhandler: if err.number = -2147467259 errorcount = errorcount + 1 'this set 0 @ start of code if errorcount > 5 msgbox "5 rowfetch errors occured, wider issue" end end if resume end if err.raise 'i think wrong, how raise error vba would?
i figured out:
errhandler: if err.number = -2147467259 errorcount = errorcount + 1 if errorcount > 5 msgbox "5 rowfetch errors occured, wider issue" end end if msgbox "stopped error: " & errorcount 'in testing prove error happened , avoided resume end if err.raise err.number
this part not getting right:
err.raise err.number
Comments
Post a Comment