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(err msg, 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(Err Msg 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("Er ror 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 6 3311 jc******@hotmai l.com wrote: 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.
function HandleError(Err Msg as string, Err as integer) ' Code to save error in local table etc.. ' .... end function
What happens if you put HandleError in each MDB/MDE?
Salad <oi*@vinegar.co m> wrote in message news:<Mc******* **********@news read1.news.pas. earthlink.net>. .. jc******@hotmai l.com wrote:
[SNIP]
What happens if you put HandleError in each MDB/MDE?
Well, it will compile but then my generic MDE would be hard coded to
work with only 1 particular HandleError routine...
This is an issue because, for example, if:
1. DB 1 saves errors in d:\db\dberr.mdb
2. DB 2 only displays errors
3. DB 3 saves errors in d:\db3\dberr.md b
My Generic MDE file should call the Calling Apps HandleError routine
and so perform the appropriate function when an error occurs.
Regards
Ju Chao
Ju Chao wrote: Salad <oi*@vinegar.co m> wrote in message news:<Mc******* **********@news read1.news.pas. earthlink.net>. ..
jc******@hotm ail.com wrote:
[SNIP]
What happens if you put HandleError in each MDB/MDE?
Well, it will compile but then my generic MDE would be hard coded to work with only 1 particular HandleError routine...
This is an issue because, for example, if: 1. DB 1 saves errors in d:\db\dberr.mdb 2. DB 2 only displays errors 3. DB 3 saves errors in d:\db3\dberr.md b
My Generic MDE file should call the Calling Apps HandleError routine and so perform the appropriate function when an error occurs.
Regards
Ju Chao
I added a reference to Northwind. I then opened Northwind and attempted
to create a reference to the main app. It would not do that, and it
complained of a circular reference.
So I tried something else. This concept may do what you want. You'll
need to modify it to your needs.
In DB1, I created the following routines in Module1. I also created a
reference to Northwind.
Sub Junk()
JunkExternal
MsgBox "I'm back again"
End Sub
Public Sub JunkMain()
MsgBox "Hello from Main Module"
End Sub
I opened Northwind and then added the following routines.
Public Sub JunkExternal()
MsgBox "Hello From Module Northwind"
RunAccessSub
End Sub
Public Sub RunAccessSub()
Set appAccess = CreateObject("A ccess.Applicati on.8")
appAccess.OpenC urrentDatabase "C:\Test\db1.md b", False
'Run proc in DB1
appAccess.Run "JunkMain"
appAccess.Quit
Set appAccess = Nothing
End Sub
I'd be curious to hear back if this concept works for you.
Salad <oi*@vinegar.co m> wrote in message news:<Zssad.13 I added a reference to Northwind. I then opened Northwind and attempted to create a reference to the main app. It would not do that, and it complained of a circular reference.
So I tried something else. This concept may do what you want. You'll need to modify it to your needs.
In DB1, I created the following routines in Module1. I also created a reference to Northwind.
Sub Junk() JunkExternal MsgBox "I'm back again" End Sub
Public Sub JunkMain() MsgBox "Hello from Main Module" End Sub
I opened Northwind and then added the following routines. Public Sub JunkExternal() MsgBox "Hello From Module Northwind" RunAccessSub End Sub
Public Sub RunAccessSub() Set appAccess = CreateObject("A ccess.Applicati on.8") appAccess.OpenC urrentDatabase "C:\Test\db1.md b", False
'Run proc in DB1 appAccess.Run "JunkMain"
appAccess.Quit Set appAccess = Nothing End Sub
I'd be curious to hear back if this concept works for you.
I understand what you are doing and that would work. The only issue(s)
I have with that approach are:
1. The second module (Northwind in your case) is hardcoded to call the
parent app. It should determine the calling app itself.
2. It would be quite slow; what you are doing is opening a second
instance of Access to run the sub... it would be ideal to just call
the current instance of the parent app from within the addin as it is
already in memory.
Hmmm.. has to be a solution here somewhere.
Thanks for your continuing ideas.
Ju Chao
Ju Chao wrote: Salad <oi*@vinegar.co m> wrote in message news:<Zssad.13
I added a reference to Northwind. I then opened Northwind and attempted to create a reference to the main app. It would not do that, and it complained of a circular reference.
So I tried something else. This concept may do what you want. You'll need to modify it to your needs.
In DB1, I created the following routines in Module1. I also created a reference to Northwind.
Sub Junk() JunkExternal MsgBox "I'm back again" End Sub
Public Sub JunkMain() MsgBox "Hello from Main Module" End Sub
I opened Northwind and then added the following routines. Public Sub JunkExternal() MsgBox "Hello From Module Northwind" RunAccessSub End Sub
Public Sub RunAccessSub() Set appAccess = CreateObject("A ccess.Applicati on.8") appAccess.OpenC urrentDatabase "C:\Test\db1.md b", False
'Run proc in DB1 appAccess.Run "JunkMain"
appAccess.Quit Set appAccess = Nothing End Sub
I'd be curious to hear back if this concept works for you.
I understand what you are doing and that would work. The only issue(s) I have with that approach are: 1. The second module (Northwind in your case) is hardcoded to call the parent app. It should determine the calling app itself.
Yes. You would need to change the functions so you would pass the
calling database name.
2. It would be quite slow; what you are doing is opening a second instance of Access to run the sub... it would be ideal to just call the current instance of the parent app from within the addin as it is already in memory.
Are you planning on lots of errors? :-).
I'm not sure how to do it. I think Michka would be the best person to
answer the question. If he were to step in, you'd get a definitive answer. Hmmm.. has to be a solution here somewhere.
Thanks for your continuing ideas.
Maybe start another post/thread, and use Michka in the subject line.
Maybe he'd spot it and answer it.
Ju Chao
Salad <oi*@vinegar.co m> wrote in message news:<7d******* *********@newsr ead1.news.pas.e arthlink.net>.. . Ju Chao wrote: I understand what you are doing and that would work. The only issue(s) I have with that approach are: 1. The second module (Northwind in your case) is hardcoded to call the parent app. It should determine the calling app itself.
Yes. You would need to change the functions so you would pass the calling database name.
2. It would be quite slow; what you are doing is opening a second instance of Access to run the sub... it would be ideal to just call the current instance of the parent app from within the addin as it is already in memory.
Are you planning on lots of errors? :-).
I'm not sure how to do it. I think Michka would be the best person to answer the question. If he were to step in, you'd get a definitive answer.
Hmmm.. has to be a solution here somewhere.
Thanks for your continuing ideas.
Maybe start another post/thread, and use Michka in the subject line. Maybe he'd spot it and answer it.
I wonder if Michka does a search for "Michka" on the news groups? In
which case, maybe this will come up on his search:
Michka Michka Michka Michka Michka Michka Michka Michka Michka Michka
:-)
I'll start a new post.
Thanks Salad.
Ju Chao This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jaime Rios |
last post by:
Hi,
I created a COM AddIn for Word that performs the functions
that it needs to, but I needed to add the ability for the
toolbar created by the COM AddIn to remember it's last
position and whether it was docked or not. I added the
following code to my "OnConnection" function but it fails
with an error, "Run-time exception thrown :
System.IO.IOException - Bad file name or number."
With applicationObject.CommandBars("SampleToolbar")
|
by: scott |
last post by:
hi all, hope some one can help me. Ill try and explain what im trying to do
as best i can.
i have a parent class that has a vertual function, lets call it virtual int
A(). That vertual function does somthing that must be done. This meens
that when a child class inherits the class and creates its own vertual int
A() the parent class must also be called. the prob is i can not use the
base class name and then its functino name after it...
|
by: anthonyberet |
last post by:
This is the first time I have tried out functions (is that the main way
of making subroutines in Python?)
Anyway, my function, mutate, below
#make a child string by randomly changing one character of the parent
Def mutate():
newnum=random.randrange(27)
if newnum==0:
|
by: jalkadir |
last post by:
Let's say that I have this class:
class Parent{
private: char* str;
public: const char* getStr(){return str;}
};
And then I create a child class
class Child{
private: std::string str;
public: std::string& getStr(){return str;}
|
by: Jon Hyland |
last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I
can't figure it out. How can I handle form events in my main code
page??
I'm creating a Windows App in C#. Rather than make my main form the
startup object, I'd rather put my Main() function in a class or code
file. Why? Because thats what I always do in standard C++ or VB. In
my opinion, writing all my application logic in the form itself is
sloppy and only for...
| |
by: Nick Flandry |
last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my
development environment (Win2K server running IIS 5) and a test environment (also Win2K server
running IIS 5), but fails on IIS 6 running on a Win2003 server.
The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide
some common functionality. The Page_Load handler the failing webpage starts out like this:
...
|
by: guilligan.geo |
last post by:
Hello,
I'm trying to create an addin for Outlook 2002 using the one provided
in the demo of win32com as a starting point. I've been able to do my
addin and test it if I go the "standard" way (using the python
interpreter). But now, I want other poeple to use it to I want to
freeze it for windows using py2exe and py2exe is giving me a headache.
First, I cannot seem to be able to register my addin with the resulting
executable. I've...
|
by: sandhya |
last post by:
Iam facing a peculiar issue when i try to reference a .net dll within a .net
Excel Addin dll created
through Extensibility projects.
Whenever i try to create the object of the class in the referenced dll using
new from the Excel addin dll ,the control
never goes to that particular function in the excel addin dll where the
object is created when the addin dll is loaded by Excel .
But when i comment the code which creates the object using...
|
by: Christof Nordiek |
last post by:
Hi,
I created an Addin Project with the Addin-Project-Wizzard in VS2005. I added
some code from a Knowledge Base How To und built the project.
It worked, and the Addin got registered with Outlook.
Now my questions are:
How an when did the registering took place?
Whre is the informations stored, to wich Application the Addin should be
bound?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |