Results 1 to 8 of 8
  1. #1
    Caplande is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2020
    Posts
    12

    ACCESS VBA:Calling procedure name extraction

    My question is the following:
    Is it possible to simply get in a procedure named B, called by a procedure named A, the name of the calling procedure (ie A)?
    Thanks for your help


    Caplande

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You could passe the name of procedure A to procedure B when B is called:
    Code:
    Public Sub subA()  Call subB("subA")
    End Sub
    
    Public Sub subB(str As String)
      MsgBox str
    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Caplande is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2020
    Posts
    12
    This is precisely what I want to avoid

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by Caplande View Post
    This is precisely what I want to avoid
    I'm sorry that my attempt to assist you is of such little value to you. Good luck with your endeavour.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Caplande is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2020
    Posts
    12
    Sorry to have appeared unpleasant. It was not my goal, I just wanted to complete my question. Indeed, I had not indicated in my subject that I wanted to avoid this solution.
    My apologies if you got hurt by my answer.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Suggest you rephrase your question then, because my interpretation of what you want is the same and I don't see any follow up post where you've clarified. I'm not saying I would have given the same answer, just that whatever "This" is in This is precisely what I want to avoid isn't clear.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    wvmitchell is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2020
    Posts
    24
    Quote Originally Posted by Caplande View Post
    My question is the following:
    Is it possible to simply get in a procedure named B, called by a procedure named A, the name of the calling procedure (ie A)?
    Thanks for your help
    Caplande
    There is no direct way to do that. You might consider creating a global variable and set that = A before you call B, and then inside B you just read the variable. However Bob's suggestion to simply pass the name of the caller would work, and would be more maintainable.
    There is a CodeContextObject in Access, but that only returns the current proc, not where it came from.

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    never tried it but suggest take a look at this link, see if meets your requirements
    https://brainsnapped.com/2015/03/10/...-stack-in-vba/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Data Extraction
    By faisal88 in forum Access
    Replies: 6
    Last Post: 01-11-2017, 09:14 PM
  2. Procedure not calling in a sub form
    By tcheck in forum Access
    Replies: 12
    Last Post: 08-24-2016, 02:45 PM
  3. Zip file extraction
    By pacd97867 in forum Programming
    Replies: 2
    Last Post: 03-05-2015, 02:58 PM
  4. data extraction for overseas
    By mathanraj76 in forum Programming
    Replies: 5
    Last Post: 08-22-2013, 04:03 AM
  5. Data Extraction/update
    By Steven.Allman in forum Queries
    Replies: 4
    Last Post: 02-24-2011, 02:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums