Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Log procedure 2 b shared by several dbs. what's the best method? 2

Status
Not open for further replies.

jojones

Programmer
Dec 4, 2000
104
AU
Hi there

I have an error handling procedure which gets various data (err.number, some variables, currentdb.name etc..) and puts it into a db using ADO.

My problem is that I have several databases that use this same procedure. I currently have the error handling code in each database, so if I want to make a change to the code I have to update it in every database.

What is the best method for centralising this code where all my databases can access it.
(FYI - After an error occurs the procedure that was running will NOT always be exited.)

Thanks in advance. Jo :)
 
If the procedure doesn't interact directly with the db, form, etc, that's calling it, you can code the function/sub in the error db and have the rest just call it, passing the info as parameters. If it does interact directly, you may just have to edit the code in each db.
 
You could code the ErrorDb as a server library application and pass some parameters. I've got one that passes the full module.procedure name and the error object. If it were a server you would probably also want to pass the database name and maybe the username of the individual having the problems. You would then want to code the individual applications using the server to properly interface to the ErrorDb (Maybe a common ErrorDb interface class). Then build some forms to view the error messages stored in the ErrorDb.

Application.Run "ProcedureName"

Steve King Growth follows a healthy professional curiosity
 
Steve - how do I code the ErrorDb as a server library application?

Jo
 
Put the error handler in a seperate file & rename it *.mda then load it as an addin into each file that uses it. AFAIK you can then call the modules in the mda as if they were in your main application. There are some things you can't do (though I can't think of what they are at the minute!) in an addin, but nothing that should affect you in any way. When you make changes to your error logging code, you only have to change the code in in mda file.
HTH
Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
What Ben said is true. You will need to find some documentation on creating the add-in. It will require that you build a USysRegInfo file, learn the difference between the CurrentDb and CodeDb when using database objects, create a function to act as the entry into the add-in, and placing the .mda file in the add-ins directory. Then the application should recognize it as and add-in and allow you to add it using the add-in manager. Don't forget to build an Error Management class that will be used to load the tables in the newly created add-in with error data from each client application. And build a form in the server which will access the error log tables from any client for display. The form should not use a stored query as it's recordsource because it will not be found from the client. This is not really difficult but I've found very little documentation in the books I've purchased. Good Luck!

Steve King Growth follows a healthy professional curiosity
 
You guys have been a great help. I have got it working now (very excited). I sure know hope you are around next time I need to find something out.

Thanks again Jo :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top