I program all reusable components into DLLs or OCXs. To provide a consistent error-handling technique across all my projects, I use the Raise method of the Err object in all these components and display the error only in the code module of first entry?such as Command1_Click. Because an error can be generated several layers deep in the code, I propagate the location of the error using this Raise statement in all my reusable components:
ThisProcEH: Err.Raise Err.Number, "ThisProc" & vbCr & Err.SourceExit Sub
This way, the whole call stack is returned to?and can be displayed in?the calling procedure (through Err.Source), making errors much easier to find and solve.