How do you guys handle having an error in a nested sub?
What I usually do is have each sub have their own error handling that way I can have a variable that tells me where the error happened and use a global error handling routine, which when it's done running it closes access.
My current employer doesn't want access to close when an error occurs, so that kind of puts me in a bind.
Below is my "template" sub
now when it's the top sub, no problem. but when it's nested how do I get the calling sub to stop processing?
I've thought about using "End" but I've heard that leaves bits and pieces behind.
I've also thought about just letting the error bubble up. However I am afraid of what would happen to my call stack as my assumption is that if I took out the error handling part in the nested sub my exit sub code would be skipped and the calling sub's entry in the call stack wouldn't be removed.
I'm sure it's something simple that I'm overlooking.
Thanks for all your help.
What I usually do is have each sub have their own error handling that way I can have a variable that tells me where the error happened and use a global error handling routine, which when it's done running it closes access.
My current employer doesn't want access to close when an error occurs, so that kind of puts me in a bind.
Below is my "template" sub
Code:
Sub SandboxMod()
If blnErrHandle Then On Error GoTo errHandler
PushCallStack "SandboxMod"
'Declarations
'Initializations
'<Code Entry>
exitsub:
PopCallStack
Exit Sub
errHandler:
'Updating error log with information
errorHandling
GoTo exitsub
End Sub
now when it's the top sub, no problem. but when it's nested how do I get the calling sub to stop processing?
I've thought about using "End" but I've heard that leaves bits and pieces behind.
I've also thought about just letting the error bubble up. However I am afraid of what would happen to my call stack as my assumption is that if I took out the error handling part in the nested sub my exit sub code would be skipped and the calling sub's entry in the call stack wouldn't be removed.
I'm sure it's something simple that I'm overlooking.
Thanks for all your help.
Last edited: