Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2003
    Posts
    81

    Unanswered: Me.Procedure.Name??

    In a procedure, the statement "Me.Name" refers to the form a procedure belongs to. I need to capture the name of the procedure itself. I am looking for something of the like "Me.Procedure.Name". How to do it?

    Thanks,

    Bjorn

  2. #2
    Join Date
    Sep 2009
    Posts
    1

    procedure name?

    Hi Bjorn,

    Did you ever find an answer to how to programmatically retrieve the name of the currently executing procedure with something like:

    cProcName = me.procedure.name

    Thanks,
    Jase

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    That would be a nice thing to know! It would make error logging a whole lot more accurate!

    Not entirely certain it's possible though.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    IIRC (it is a long time ago I looked at this for an error handler) you can get the name from the call stack. I can't remember how but I ma pretty sure it was far too much of a ball ache to pursue.
    I would probably do something like hard code the name and assign to a variable in my boilerplate as a cheap and cheerful alternative.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2005
    Posts
    261
    Although not a free solution, this product of mine gives you a global callback into VBA when an error occurs, and allows you to retrieve advanced info such as the module / procedure of error very easily (and much more besides). There is a free trial developer edition on the website for you to try the product out freely (not redistributable).

    SimplyVBA Global Error Handler for Visual Basic for Applications

    HTH

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by pootle flump
    IIRC (it is a long time ago I looked at this for an error handler) you can get the name from the call stack. I can't remember how but I ma pretty sure it was far too much of a ball ache to pursue.
    I would probably do something like hard code the name and assign to a variable in my boilerplate as a cheap and cheerful alternative.
    This is my preferred method of attack with error handling blocks in general.

    Pass on what it is you'd like to get logged instead of relying on esoteric or downright bizarre mechanisms for auto-discovery. It ends up being very little work to include identifying information in your exception or execution logging once you're in the habit.

    I also like this approach because it allows you to decouple your logging mechanisms from the application platform. You don't NEED to rely on some wonky application-specific method of retrieving meta data, and you can incorporate disparate application platforms in to a unified logging/exception handling mechanism if it makes sense to do so later.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •