A general error handler may look similar to this:
Code:
Private Sub Command1_Click()

On Error GoTo ErrHandler

    'main code goes here

    Exit Sub

ErrHandler:

    'you may have select case err.Number here
    'or Err.Clear
    'you may also (if necessary) display message box with err.description (MsgBox Err.Description)
    'and/or Resume or Resume Next
    'and/or Exit Sub 'or function

    'etc, etc, etc...

End Sub