Dear All,
I have an MDB file (Access 2000/XP) which contains generic routines I
use in various apps (eg, API calls, File access classes etc).
I have compiled into an MDE file which I reference in VBA from my other
Access applications.
This works fine and I'm quite happy with it... except for one area;
error handling. In most of my functions I call an error handler which
stores the details of the error into a table so that I can review the
error log in future. What I would like is for my ADDIN to call the
error function stored in the CALLING application so that any errors
that occur in the addin are recorded and actioned as per the error
handler of the calling function... is this possible? If I try to refer
to a generic error handler (eg HandleError(errmsg, err) from the ADDIN,
ofcourse the compiler complains this function doesn't exist because it
doesn't know that I'm using this MDE as an addin in future... if I add
a REFERENCE to my calling app, then that means that ADDIN will only
work for that app !?
In case thats not very clear heres an example of what I'm attempting;
Calling app: Main.MDB
function test()
call testaddin()
end function
function HandleError(ErrMsg as string, Err as integer)
' Code to save error in local table etc..
' ....
end function
Addin App: ADDIN.MDE
function testaddin()
on error goto handleerror
dim a as integer
a = 0/0
errexit:
exit function
handleerror:
HandleError("Error Occurred", err)
resume errexit
end function
- results in a compile error as Handle Error is not known in the
ADDIN.mde....
If this isn't possible, am I perhaps trying to achieve this in the
wrong way and there is a better option/idea??
Many thanks,
Ju Chao