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

    Scope of Public Functions


    Given a from that is open and its module contains a Public Function, why can't Access find the function when it's referenced by a right-click popup shortcut menu initiated by that form. I have mdb DB's where that works fine, but a recent accdb DB app can't find the function with the same arrangement of modules. Do accdb versions of access have a DB setting that requires some sort of reference? I saved the DB as 2000-2003 mdb, but that failed as well. No problem with any of this if I put the Public Functions(s) in a general module.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    In my experience such functions have to be in standard modules. I have seen people call form-level functions from outside the form by referencing the form first, but I just put them in a standard module. I had an app that used right-click menus extensively, but it was replaced by a canned app years ago and I've forgotten everything I ever knew about them. Hopefully somebody with more knowledge of them will know how to call your functions.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Paul. These days, I would start with the functions in a standard module and if push-comes-to-shove I'll solve this issue with some gating functions that essentially get me from a general module to where I need to keep the current functions, as they have a boat-load of interaction with code elements of the form. The functions themselves are inherited from an older app and a redo isn't justified. The older app from which they came is the 2000-2003 mdb I referred to in the OP.
    Bill

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem Bill. I was going to mention gating functions but wouldn't have come up with the cool name.

    Let's do lunch soon!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    have come up with the cool name
    They're actually called "Transfer Vectors", but the young'uns following the thread might not have any OS experience to know that that means.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by GraeagleBill View Post
    the young'uns following the thread might not have any OS experience to know that that means.
    Nor does this old'un.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    OH! And, yes, we'll get some action going towards having lunch.

  8. #8
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I solved the OP by coding a general module and transferring the right-click shortcut references to the functions contained in the form's module. Those calls still needed to use the forms method:
    Code:
    Call Forms("FormName").FunctionName(arg)

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

Similar Threads

  1. Functions - Scope of visibility within Access
    By GraeagleBill in forum Programming
    Replies: 2
    Last Post: 04-10-2021, 02:47 PM
  2. Replies: 1
    Last Post: 04-12-2020, 12:52 PM
  3. Replies: 4
    Last Post: 01-25-2019, 09:03 PM
  4. Public Functions and Private Subs
    By d9pierce1 in forum Programming
    Replies: 15
    Last Post: 11-28-2018, 09:25 AM
  5. Public Functions for Command Buttons
    By d9pierce1 in forum Forms
    Replies: 10
    Last Post: 11-25-2018, 01:57 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