[AccessD] Handing error back down call stack?
Rocky Smolin
rockysmolin2 at gmail.com
Thu Jun 16 10:04:51 CDT 2022
Ryan:
The way I've handled this before is to define BarFoo as a Function "AS
Boolean" and pass back True or False to the calling routine.
Set BarFoo = True on entry to the function. Set BarFoo = False if exiting
through the error handler.
In the calling function:
If BarFoo = True Then
HaveABeer
Else
FixTheError
End If
HTH
Rocky
On Thu, Jun 16, 2022 at 6:51 AM Ryan W <wrwehler at gmail.com> wrote:
> What's the best / ideal way to hand an error back down the call stack?
>
> Say I have
>
> Public Function FooBar()
> on error goto handler
>
> call BarFoo
>
> exitroutine:
> 'cleanup code here
> exit function
>
> handler:
> msgbox err.number & " " & err.description & " in routine FooBar"
> resume exitroutine
> End Function
>
> I want the error from BarFoo to come back to function FooBar so I can
> handle it there. As of right now the error handler in BarFoo throws the
> error but I need to catch it in the calling procedure.
>
> Right now it seems like if I trap the err.number and err.description into
> variables and Err.Raise those in my error handler in the called function
> might be the way to go?
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list