[AccessD] Handing error back down call stack?
Stuart McLachlan
stuart at lexacorp.com.pg
Thu Jun 16 15:21:48 CDT 2022
Or AS LONG and you can set any value you like in your error handler
handler:
Function = Err
End Function
Then test the return value from BarFoo for <> 0 and handle the return value appropriately.
On 16 Jun 2022 at 8:04, Rocky Smolin wrote:
> 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
> >
> --
> 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