Results 1 to 5 of 5

Thread: [Access 2000] automated Updaing Modules,Form Classes

  1. #1

    Thread Starter
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Question [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:
    1. On Error GoTo ErrorHandler
    2. iniclsUser
    3. CreateSiteEvent "test", "TESTING", 1
    4. CreateJobEvent "test", "TESTING", 1
    5.  
    6. ErrorHandler:
    7. 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
    This is Blank

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    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.

    BOFH Now, BOFH Past, Information on duplicates

    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...

  3. #3

    Thread Starter
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    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
    This is Blank

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    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

    BOFH Now, BOFH Past, Information on duplicates

    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...

  5. #5
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    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
  •  



Click Here to Expand Forum to Full Width