>>The point remains valid that in order to receive the exact "Type mismatch" message, I must do local error trapping. Even in your example, the details are changed when the code passes Err.Raise.<<
Of course the error message changes, your code changes it.
Chris, you miss the point. I am not talking about my code. I am pointing out that even your code changes the Err object when the Err.Raise occurs. That is, it does NOT contain the Source and Description Err.Raise told the error to be.
In your code you have:
Code:
Err_Clear:
MsgBox "Class: clsObjProjectsTbl, Subroutine: Clear()"
Err.Raise vbObjectError + 1, [B][COLOR=Red]"Class: clsObjProjectsTbl, Subroutine: Class_Initialize()", "Error: Failed to instantiate class instance."[/COLOR][/B]
Resume Exit_Clear
As soon as the code passes the Err.Raise LOC, the global Watch on the Err object changes to: "Error: Failed to instantiate class instance."
So even your code example does not deliver the custom message Err.Raise told the Err to be.
"Error: Failed to instantiate class instance." is better than "Automation Error"... just it is NOT the custom Err text.
The only way I found to Err.Raise and successfully receive in the caller program the custom message sent via Err.Raise was to turn off error handling, then Err.Raise a brand new Err.
That is... The way VBA / Access appear to work is:
1) Handle the exact error locally
2) Turn off error handling
3) Err.Raise a new error
In order to not have VBA tamper with the evidence.
Side note: I think perhaps if I truly wanted to raise only one error / the exact error, then one would capture into local variables all of the Err object attributes, shut off error handling, and Err.Raise a new Err object based on the saved data. I feel that such is too many LOC's in order to achieve a one MsgBox error handler.