|
-
Oct 31st, 2008, 05:35 AM
#1
Thread Starter
Hyperactive Member
[Access 2000] automated Updaing Modules,Form Classes
Hi,
I have built an app and wish to add simple Erorr handling.
My basic error handling will be
VB Code:
On Error GoTo ErrorHandler
iniclsUser
CreateSiteEvent "test", "TESTING", 1
CreateJobEvent "test", "TESTING", 1
ErrorHandler:
LogError err.Number,"mdlGlobal","testSiteCreation",err.Description
is there a way to open each module and add these lines Capturing the Module name that i am in and the sub/function name using code ?
thansk
David
-
Oct 31st, 2008, 06:35 AM
#2
Re: [Access 2000] automated Updaing Modules,Form Classes
Not sure if there is something in the err class (type err. into the debug window and see.
Otherwise, create a global (public) variable, set it when entering a sub/function so if it errors you know where.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Oct 31st, 2008, 06:46 AM
#3
Thread Starter
Hyperactive Member
Re: [Access 2000] automated Updaing Modules,Form Classes
hi,
Sorry i think i did not explain well enough.
I want to write a module that will actualy open the modules and form classes then at the top after the var declaration it will put in the code to declare the error handler and then add the actual Error handling at the botom (inclsive of exit sub at the botom where the code as temrminated)
thanks
David
-
Oct 31st, 2008, 07:27 AM
#4
Re: [Access 2000] automated Updaing Modules,Form Classes
It is possible to do, but
It will require some advanced coding 
also you'd need to add the error handling to all subs/functions not just hte module.
I think you can find it in DAO fairly easy, as DAO is access based it should allow you to open and view code. Not sure about the actual editting and saving tho.
Perhaps search msdn as they usually have something on it. Or google search.
if you can find stuff using the intellisense at least you can search for help on it directly
good luck
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Nov 3rd, 2008, 07:51 PM
#5
Fanatic Member
Re: [Access 2000] automated Updaing Modules,Form Classes
Hey, Davadvice. First I would like to introduce you to MZ-Tools. It's free for office VBA and has lots of nice tools that you don't know you can't live without. One of them will add error handling to a sub with the click of a toolbar button. You can customize how it handles this.
http://www.mztools.com/index.aspx
Now to directly answer your question, you will be dealing with the VBIDE object. This method of modifying code is exactly the same for all VBA applications. You will find tutorial and example code here.
http://www.cpearson.com/excel/vbe.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|