Results 1 to 3 of 3
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Functions - Scope of visibility within Access

    I have several "old apps" that when developed used "Right-click" functions extensively. In most cases, the right-click function involved launching a "Public Function" to carry out the desired task. The mystery for me has always been "where to code the Public Function?". Most of the time, Access only "sees" the Public Function if it's coded in a general module, but I have several instances where the Public Function is coded within a "form's module". (The latter not to be confused with functions referenced within an Event.) Currently, I have a case where Access can ONLY "SEE" the Public Function when the code is within a general module, whereas I'd really like to have it within the form where it is needed.



    For those of you that might not have experiences in the early versions of Office, below are examples of how pop-up menus were supported. In the first of the two examples shown, the Function "=DelRes(0)" is coded within the form that makes use of the form. How it is that ACCESS finds that code whereas in some cases it can't is my question?
    Click image for larger version. 

Name:	000.jpg 
Views:	19 
Size:	74.2 KB 
ID:	44957Click image for larger version. 

Name:	001.jpg 
Views:	19 
Size:	85.0 KB 
ID:	44958

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    IIRC, only public functions in standard module could be called by custom menus. You're saying that is not the case?
    I have several instances where the Public Function is coded within a "form's module"
    Does this help?
    https://docs.microsoft.com/en-us/off...and-visibility
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Yes, the "=DelRes(0)" function you see specified in the 1st of the two OP images is coded in the form's module and executes normally when the "Delete Resident" option is selected from the right-click popup.

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

Similar Threads

  1. Keeping a variable in scope
    By azizrasul in forum Programming
    Replies: 9
    Last Post: 03-28-2019, 04:40 PM
  2. Replies: 6
    Last Post: 10-21-2015, 03:08 PM
  3. built in functions in access 2010
    By Jean S in forum Access
    Replies: 5
    Last Post: 12-05-2012, 11:22 PM
  4. Need some help on the variable scope
    By blueraincoat in forum Forms
    Replies: 3
    Last Post: 05-26-2011, 01:37 AM
  5. Writing Access functions
    By new2access123 in forum Programming
    Replies: 5
    Last Post: 02-06-2010, 10:47 PM

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