The "On Error GoTo <label>" refers to a label elsewhere in the procedure to go to. In the
example you gave, there would be a line in the procedure
Err_cmdfrmReview_Click:
This is the point that the error handler would jump to if there is an error. Here is an
example of a common, basic error handler.
Example:
Private Sub SomeSubroutine()
On Error GoTo HandleError
'Some code here that may create an error
CleanUp:
On Error Resume Next
rst.Close
Set rst = Nothing
Set db = Nothing
Exit Sub
HandleError:
MsgBox Err.Number & vbCrLf & Err.Description, , "Error"
Resume CleanUp
End Sub
This will go to the error handler marked by HandleError: if there is an error. When the
error handler is done it take you to the routine to clean up any object variables that may
have been set. The clean up of these is before the error handler, because if the code
finishes normally, I want it to run the clean up routine anyway. You then put an Exit Sub
or Exit Function (depending on whether you're in a sub or function) to keep the code from
getting to the error handler during normal processing.